简体   繁体   English

无法获取Facebook access_token

[英]failed to get facebook access_token

This is a part of getting access_token taken from facebook-sdk example. 这是从facebook-sdk示例获取access_token的一部分。 After I get the code , I do exactly following the example as below 获得code ,我将完全按照以下示例进行操作

 if self.request.get("code"):
            args["client_secret"] = FACEBOOK_APP_SECRET
            args["code"] = self.request.get("code")
            response = cgi.parse_qs(urllib.urlopen(
                "https://graph.facebook.com/oauth/access_token?" +
                urllib.urlencode(args)).read())
            access_token = response["access_token"][-1]

The error I get from response is 我从response中得到的错误是

'{"error":{"message":"Error validating verification code. Please make sure your redirect_uri is identical to the one you used in the OAuth dialog request","type":"OAuthException","code":100}}

Can anybody tell me what is wrong? 谁能告诉我哪里出了问题?

This is the link I get in order to get access_token 这是我为了获得access_token而获得的链接

https://graph.facebook.com/oauth/access_token?code=AQD3K0Qc-9mJ1pUIWovhbO549GIk-X_y2v6VRbjFB_WtHMtINtU6GTZ4T2rBbjUr9teiGbhxsBm23xjRXhX4CfWdMXgsNXjgTOUeG9Nz6oNmgluvZwv3oQQ42w8vBTowlDGOdKvmW065WrQTLW3e8oZJ7C_XNwUl5bYDD5JF_JLD9O4BBfAGbfRHWHAf6Yy0ewaJr8MmtU-qhemYe8mQ2hrM&client_secret=xxxxx&redirect_uri=http%3A%2F%2F127.0.0.1%3A8088&client_id=xxxx

It has https://graph.facebook.com/oauth/access_token? 它有https://graph.facebook.com/oauth/access_token? code , client_secret , redirect_uri , client_id codeclient_secretredirect_uriclient_id

Do I miss any parameters to get access_token? 我会错过任何参数来获取access_token吗?

I got it. 我知道了。 My redirect_uri need a dash "/" at the end of the url. 我的redirect_uri在网址末尾需要一个破折号“ /”。

It should be " http://abc.com / " 它应该是“ http://abc.com /

Too much painful to find the mistake 找不到错误太痛苦了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM