Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't OAuth with Facebook; what are my next debugging steps?
    primarykey
    data
    text
    <p>I've got a Django template that initiates the <a href="https://developers.facebook.com/docs/authentication/" rel="nofollow">Facebook OAuth process</a> by doing:</p> <pre><code>window.location='https://www.facebook.com/dialog/oauth?client_id=MY_CLIENT_ID&amp;redirect_uri=http%3A//localhost%3A8000/fbpanel/explore-python' </code></pre> <p>Then, in my Django view, I get the resulting code as follows:</p> <pre><code>import cgi import urllib # [...] code = request.GET['code'] args = { 'client_id': MY_CLIENT_ID, 'redirect_uri': 'http://localhost:8000/fbpanel/explore_python' 'client_secret': MY_CLIENT_SECRET, 'code': code, } url = 'https://graph.facebook.com/oauth/access_token?' + \ urllib.urlencode(args) raw_response = urllib.urlopen(url).read() response = cgi.parse_qs(raw_response) if response: error = '' if response['access_token']: access_token = response['access_token'][0] if response['expires']: expires = response['expires'][0] else: access_token = 'No access token returned' expires = 'No expiration given' error = raw_response </code></pre> <p>Invariably, <code>response</code> is <code>None</code> and <code>raw_response</code> contains <code>Error: {"error":{"message":"Error validating verification code.","type":"OAuthException"}}</code></p> <p>The same credentials validate fine with the <a href="https://developers.facebook.com/docs/reference/javascript/" rel="nofollow">JavaScript SDK</a>. I was binding my server to <code>localhost</code> in that case too, and have <code>localhost:8000</code> set in my official app domain. Before I did that, the JavaScript wouldn't work. After, it did. So I don't think <code>localhost</code> is the issue.</p> <p>I've manually stepped through the code, printing the <code>code</code> returned by FB out, then manually running the above code line by line in the python interpreter, and I can't see anything I'm doing wrong. What are my next debugging steps? The FB documentation offers little guidance if you receive an <code>OAuthException</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload