【问题标题】:LinkedIn API error of redirect uri from httr从 httr 重定向 uri 的 LinkedIn API 错误
【发布时间】:2020-10-29 09:22:29
【问题描述】:

我正在尝试使用 R 和 httr 包访问 LinkedIn 的 API。

当我执行最后一个 oauth2.0_token() 函数时,为了获得授权令牌,我从 LinkedIn 收到以下错误:"The redirect_uri does not match the registered value"

我已将 LinkedIn 开发者网站上的重定向网址设置为 http://my_app_54321

有谁知道解决方法是什么?

# 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

【问题讨论】:

标签: r api oauth-2.0 linkedin httr


【解决方案1】:

my redirected url 更改为以下解决了它,因为我只需要应用程序在本地运行。

http://localhost:1410/

httr 包的 GitHub 中的 cmets 指向了这个方向:

https://github.com/r-lib/httr/blob/master/demo/oauth2-linkedin.r

【讨论】:

  • 我在 Linkedin 开发门户中添加了这个,现在我得到“身份验证完成。请关闭此页面并返回 R。”在浏览器窗口中。但是在 R 之后我得到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. 我想知道它是否仍然适合你?
  • 嗨,你能发布你的代码,创建一个新问题并标记我吗?那我可以看看:)
  • 谢谢,我在这里发了一个问题:stackoverflow.com/questions/63621616/…
猜你喜欢
  • 2018-08-14
  • 1970-01-01
  • 2019-01-24
  • 1970-01-01
  • 2020-02-07
  • 2015-09-13
  • 2018-08-17
  • 2019-04-10
  • 2015-03-07
相关资源
最近更新 更多