oauth2.0 LinkedIn -获取访问令牌错误invalid_redirect_uri

nqwrtyyt  于 2023-01-01  发布在  其他
关注(0)|答案(1)|浏览(222)

有人在这里成功连接到API了吗?我按照docs上的说明操作,但未能检索到授权码。以下是我请求获取access_token的POST结果

{
    "error": "invalid_redirect_uri",
    "error_description": "Unable to retrieve access token: appid/redirect uri/code verifier does not match authorization code. Or authorization code expired. Or external member binding exists"
}

我使用https//airbyte.io作为redirect_uri我的GET get请求来获取授权令牌如下:

https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=78oy2gu644mxz2&redirect_uri=https%3A%2F%2Fairbyte.io&scope=r_ads,r_ads_reporting,r_organization_social

我在SO的不同线程中遵循了一些建议

  • 仔细检查了我的client_idclient_secret
  • 在GET请求中编码URI
  • 在POST请求时向redirect_url添加了范围参数
  • 已在20秒窗口内使用code测试请求。
au9on6nz

au9on6nz1#

几件事:

  1. Ensure your redirect URI is also defined within your app's configuration as an allowed redirect URI. See https://learn.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin%2Fmarketing%2Fcontext&view=li-lms-2022-11&tabs=HTTPS1#step-1-configure-your-application. The documentation specifies a certain URL to use when testing with Postman.
  2. In your authorization call, your scopes are comma-delimited. They should be space-delimited and URL-encoded. See https://learn.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin%2Fmarketing%2Fcontext&view=li-lms-2022-11&tabs=HTTPS1#step-2-request-an-authorization-code.

相关问题