Linkedin OAuth2授权码错误 [英] Linkedin OAuth2 authorization code error
问题描述
- 在linkedin中添加了我自己的应用程序。 >
- 生成授权网址: https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=XXX&范围= r_basicprofile%20r_fullprofile%20r_emailaddress& state = DCEEFWF454Us5dffef424& redirect_uri = http:// localhost:9090 / springmvc / token.htm
- 介绍linkedin的登录名/密码新的弹出窗口。
- 在redirect_uri之前取回成功的请求,并获取授权代码code
- 生成accessToken URL li>
- 通过以下方式进行发布: https://www.linkedin.com/uas/ oauth2 / accessToken?grant_type = authorization_code& code = YYY& redirect_uri = http:// localhost:9090 / SpringMVC / token.htm& client_id = XXX& client_secret = ZZZ 获取响应中的下一个错误:{error_description:缺少必需的参数,包含一个无效的参数值,参数不止一次。 :无法检索访问令牌:appId或重定向URI与授权码或授权码过期不匹配,error:invalid_request}
redirect_uri与第2步和第4步中的网址相同。我在我的APP上的OAuth 2.0重定向网址部分添加了此网址。 第一次和第二次请求之间的时间小于20秒。
我已验证的网址参数是正确的:
- code是在步骤4中接收到的令牌。
redirect_uri
参数必须是URL编码的,所以在6. do: https:// www。 linkedin.com/uas/oauth2/accessToken?grant_type=authorization_code&code=YYY&redirect_uri=http%3A%2F%2Flocalhost%3A9090%2FSpringMVC%2Ftoken.htm&client_id=XXX&client_secret=ZZZ
,它不需要作为POST发送,而是作为GET发送。
I´m trying to connect via Linkedin Auth2 from a java web application:
- Added my own app in linkedin.
- Generate the authorization URL: https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=XXX&scope=r_basicprofile%20r_fullprofile%20r_emailaddress&state=DCEEFWF454Us5dffef424&redirect_uri=http://localhost:9090/springmvc/token.htm
- Introduce my login/password for linkedin in the new popup.
- Get back successful the request on the redirect_uri previus, and take the authorization code "code"
- Generate the accessToken URL
- Make a POST with: https://www.linkedin.com/uas/oauth2/accessToken?grant_type=authorization_code&code=YYY&redirect_uri=http://localhost:9090/SpringMVC/token.htm&client_id=XXX&client_secret=ZZZ
- Get next error in response: {"error_description":"missing required parameters, includes an invalid parameter value, parameter more than once. : Unable to retrieve access token : appId or redirect uri does not match authorization code or authorization code expired","error":"invalid_request"}
I´ve verified url parameters are correct: - "code" is the token receive on step 4.
"redirect_uri" is the same URL on step 2 and 4. I added this URL on section "OAuth 2.0 redirect URL" on my APP.
"client_id" and "client_secret" are the "Client API" and "Secret API" on my APP.
Time between first and second request is less than 20 seconds.
The value of your redirect_uri
parameter must be URL-encoded, so at 6. do:
https://www.linkedin.com/uas/oauth2/accessToken?grant_type=authorization_code&code=YYY&redirect_uri=http%3A%2F%2Flocalhost%3A9090%2FSpringMVC%2Ftoken.htm&client_id=XXX&client_secret=ZZZ
and it need not be sent as a POST but as a GET.
这篇关于Linkedin OAuth2授权码错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!