[英]Linkedin API - Bad Redirect, invalid redirect URI
I am using this code with my client ID and client secret: 我将此代码与我的客户ID和客户密码一起使用:
https://github.com/DEKHTIARJonathan/python3-linkedin/blob/master/examples/oauth2_authentication.py https://github.com/DEKHTIARJonathan/python3-linkedin/blob/master/examples/oauth2_authentication.py
However, when getting the url back in the command line and putting it into the browser I am getting "invalid redirect_uri. This value must match a URL registered with the API Key." 但是,当在命令行中重新获得URL并将其放入浏览器时,我得到“无效的redirect_uri。此值必须与在API密钥中注册的URL匹配”。
I've registered the following with redirect urls in an attempt to get it working: 我已使用重定向网址注册了以下内容,以使其正常运行:
http://localhost:8080/code
https://localhost:8080/code/
http://localhost:8080/code/signin-linkedin
https://localhost:8080/code/signin-linkedin
https%3A//locahost%3A8080/code/
The signin-linkedin piece came from here: 登录-linkedin片段来自这里:
linkedin : Invalid redirect_uri. linkedin:无效的redirect_uri。 This value must match a URL registered with the API Key
该值必须与使用API密钥注册的URL匹配
However, adding that last 'sigin-linkedin' portion didn't alleviate the issue. 但是,添加最后一个“ sigin-linkedin”部分并不能缓解问题。
This is the URL that I am getting back, # in place of my client_id: 这是我要返回的URL,用#代替我的client_id:
https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=##########&scope=r_basicprofile%20r_emailaddress%20rw_company_admin%20w_share&state=04377850f3154ee3f808f762244697b6&redirect_uri=https%3A//locahost%3A8080/code/ https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=##########&scope=r_basicprofile%20r_emailaddress%20rw_company_admin%20w_share&state=04377850f3154ee3f808f762244697b6&redirect_uri=80%A3A/ /码/
Thanks in advance. 提前致谢。
Edit: 编辑:
I've tried adding some additional urls based on other posts: 我尝试根据其他帖子添加一些其他网址:
https://appname.auth0.com/login/callback https://appname.auth0.com/login/callback
https://appname.auth0.com https://appname.auth0.com
Here is my code: 这是我的代码:
if __name__ == '__main__':
CLIENT_ID = #######
CLIENT_SECRET = ##########
RETURN_URL = 'http://localhost:8080/code/'
authentication = LinkedInAuthentication(
CLIENT_ID,
CLIENT_SECRET,
RETURN_URL,
permissions=['r_basicprofile',
'r_emailaddress',
'rw_company_admin',
'w_share']
)
print(authentication.authorization_url)
application = LinkedInApplication(authentication)
It looks like your callback URL configuration has a mistake, a missing "l". 看来您的回调URL配置有误,缺少“ l”。
If you look closely at the redirect_uri
parameter, its value is https%3A//locahost%3A8080/code/
which unescaped is https://locahost:8080/code/
. 如果仔细查看
redirect_uri
参数,则其值为https%3A//locahost%3A8080/code/
,未转义的值为https://locahost:8080/code/
。
I assume you mean the value to be configured as https://localhost:8080/code/
. 我假设您的意思是将值配置为
https://localhost:8080/code/
。
Your URL encoding of the redirect_uri looks incorrect. 您的redirect_uri的URL编码看起来不正确。
For me, http://localhost:8080/code/ turns into http%3A%2F%2Flocalhost%3A8080%2Fcode%2F. 对我来说, http:// localhost:8080 / code /变成http%3A%2F%2Flocalhost%3A8080%2Fcode%2F。
You are sending "/" when it should be "%2F". 您发送的“ /”应为“%2F”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.