我正在申请与linkedin连接.我正在关注
step by step guide.要对用户进行身份验证,我从
this开始提供帮助.
当用户单击“使用linkedin连接”按钮时,用户将进入linkedin登录页面.用户授予帐户访问权限后,用户将被重定向到:
https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=1ba8ogpm9e05&scope=r_basicprofile%20r_emailaddress&state=STATE&redirect_uri=http://127.0.0.1:8088/sandBox/linkedin/test.PHP
通过这个,我得到了授权码.并将其传递给以下网址
https://www.linkedin.com/uas/oauth2/accessToken?grant_type=authorization_code&code=AUTHORIZATION_CODE&redirect_uri=http://127.0.0.1:8088/sandBox/linkedin/final.PHP&client_id=1ba8ogpm9e05&client_secret=n7GN09I3F2L3IJD1
在这里,错误来了,即
"error":"invalid_request","error_description":"missing required parameters,includes an invalid parameter value,parameter more then once. : Unable to retrieve access token : appId or redirect uri does not match authorization code or authorization code expired"
我哪里错了?我仔细检查了我的api密钥和密钥.
https://www.linkedin.com/uas/oauth2/accessToken?grant_type=authorization_code&code=AUTHORIZATION_CODE&redirect_uri=http://127.0.0.1:8088/sandBox/linkedin/final.PHP&client_id=1ba8ogpm9e05&client_secret=n7GN09I3F2L3IJD1 https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=1ba8ogpm9e05&scope=r_basicprofile%20r_emailaddress&state=STATE&redirect_uri=http://127.0.0.1:8088/sandBox/linkedin/test.PHP
根据LinkedIn authentication guide,这两个应该包含相同的redirect_uri:
Parameter:
redirect_uri
Description: required. Sameredirect_uri
that you passed in the prevIoUs step.
Possible Errors:
- Different
redirect_uri
than used during authorization code generation- Passed an invalid value
- Passed an empty or blank value
- Missing the parameter