从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获得了以下错误:"The redirect_uri does not match the registered value"
.
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开发人员站点上的重定向URL设置为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/
来自GitHub的httr
软件包的注释指向以下方向:
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屋!