从 httr 重定向 uri 的 LinkedIn API 错误 [英] LinkedIn API error of redirect uri from httr
问题描述
我正在尝试使用 R 和 httr
包访问 LinkedIn 的 API.
I'm trying to access LinkedIn's API using R and the httr
package.
当我执行最后一个 oauth2.0_token()
函数时,为了获得授权令牌,我从 LinkedIn 收到以下错误:"redirect_uri 与注册的不匹配值"
.
When I execute the last oauth2.0_token()
function, in order to gain an authorization token, I get the following error from LinkedIn: "The redirect_uri does not match the registered value"
.
我已将 LinkedIn Developer 网站上的重定向网址设置为 http://my_app_54321
I've set my redirected url on the LinkedIn Developer site to http://my_app_54321
有人知道解决方案是什么吗?
Does anyone know what the solution is?
# Packages
library(httr)
# Client info
clientid <- "my_id"
secret <- "my_secret"
# App
app <- oauth_app(appname = "app name", key = clientid, secret = secret)
# Endpoints
endpoint <- oauth_endpoint(base_url = "https://www.linkedin.com/uas/oauth2",
authorize = "authorization", access = "accessToken")
# Access token
token <- oauth2.0_token(endpoint = endpoint, app = app)
token
推荐答案
将 my redirected url
更改为以下内容解决了这个问题,因为我只需要应用程序在本地运行.
Changing my redirected url
to the following solved it since I just needed the application to run locally.
http://localhost:1410/
httr
包的 GitHub 上的评论指向了这个方向:
The comments from the GitHub of httr
package pointed in this direction:
https://github.com/r-lib/httr/blob/master/demo/oauth2-linkedin.r
这篇关于从 httr 重定向 uri 的 LinkedIn API 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!