本文介绍了R httr Linkedin API:错误的请求(HTTP 400)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题与此密切相关:

My question is closely related to this one: LinkedIn API error of redirect uri from httr

这是我的代码:

library(httr)

clientid <- "MY-ID"
secret <- "MY-SECRET"

app <- oauth_app(appname = "app name", key = clientid, secret = secret)

endpoint <- oauth_endpoint(base_url = "https://www.linkedin.com/uas/oauth2",
                           authorize = "authorization", access = "accessToken")


token <- oauth2.0_token(endpoint = endpoint, app = app)

执行此操作时,浏览器将打开并显示消息 Authentication complete.请关闭此页面并返回到R.

As I do this, the browser opens with the message Authentication complete. Please close this page and return to R.

在R中,我得到这个:

Waiting for authentication in browser...
Press Esc/Ctrl + C to abort
Authentication complete.
Error in oauth2.0_access_token(endpoint, app, code = code, user_params = user_params,  :
  Bad Request (HTTP 400). Failed to get an access token.

我在 https://www.linkedin.com/上使用赋予我的应用程序的客户端ID和密码.developers/,我确实将重定向URL设置为 http://localhost:1410/.

I use the client id and secret given to my app on https://www.linkedin.com/developers/ and I did set the redirect URL there to http://localhost:1410/.

我正在使用Ubuntu 18.04,R版本3.6.3,httr版本"1.4.2".

I'm on Ubuntu 18.04, R version 3.6.3, httr version ‘1.4.2’.

推荐答案

我解决了改变的问题 :token <- oauth2.0_token(endpoint = endpoint, app = app, scope = "w_member_social")

I solved the problem changing :token <- oauth2.0_token(endpoint = endpoint, app = app, scope = "w_member_social")

这篇关于R httr Linkedin API:错误的请求(HTTP 400)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 04:07