2

这是从 facebook-sdk 示例获取 access_token 的一部分。得到后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]

我得到的错误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}}

谁能告诉我有什么问题?

这是我为了获取 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

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

我是否错过了获取 access_token 的任何参数?

4

1 回答 1

1

我知道了。我redirect_uri需要一个破折号“/”在网址的末尾。

应该是“ http://abc.com/

找错太痛苦了

于 2013-02-07T08:12:54.793 回答