A seemingly strange OAuthException
I am learning to build fb apps, and on the very first attempt, I get this strange OAuthException. The tutorial clearly mentions that I need t开发者_开发技巧o pass redirect_uri, client_secret, client_id and code(from the app auth phase). But when the flow completes, instead of getting an access token here is the JSON error object I get:
{"error":{"message":"client_secret should not be passed to \/oauth\/access_token\/","type":"OAuthException"}}
EDIT: this is the snippet I'm using to build the url(pardon the excessive 2nd line, please)
url = "https://graph.facebook.com/oauth/access_token/"
url += "?"
url += urllib.urlencode([('client_id',client_id),
('redirect_uri', redirect_uri),
('client_secret', client_secret),
('code', code)])
where the variables hold correct values.(checked > 5 times)
You should remove the / immediately after access_token in the url so that it reads graph.facebook.com/oauth/access_token?
followed by your parameters. If that doesn't do it, please show an entire sample url you have generated (with the real client_secret x'ed out of course) since I am not familiar enough with urllib.urlencode to be sure of the formatting, although that part looks right at a glance.
精彩评论