Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 to 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)

like image 307
yati sagade Avatar asked Sep 24 '11 23:09

yati sagade


1 Answers

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.

like image 184
Floyd Wilburn Avatar answered Nov 16 '22 16:11

Floyd Wilburn