Note that there are some explanatory texts on larger screens.

plurals
  1. PO"Missing redirect_uri parameter" response from Facebook with Python/Django
    primarykey
    data
    text
    <p>This is probably a very dumb question, but I have been staring at this for hours and can't find what I'm doing wrong.</p> <p>I am trying to use Python to authenticate with the Facebook API, but am having issues requesting a user access token. After receiving a code, I make a request to <a href="https://graph.facebook.com/oauth/access_token">https://graph.facebook.com/oauth/access_token</a> like so:</p> <pre><code>conn = httplib.HTTPSConnection("graph.facebook.com") params = urllib.urlencode({'redirect_uri':request.build_absolute_uri(reverse('some_app.views.home')), 'client_id':apis.Facebook.app_id, 'client_secret':apis.Facebook.app_secret, 'code':code}) conn.request("GET", "/oauth/access_token", params) response = conn.getresponse() response_body = response.read() </code></pre> <p>In response, I receive</p> <blockquote> <p>{"error":{"message":"Missing redirect_uri parameter.","type":"OAuthException","code":191}}</p> </blockquote> <p>Any ideas what could be going wrong? I have already verified that the redirect_uri that is being passed is on the app domain, but could it be an issue that this is being hosted locally and that domain is just redirected to localhost by my hosts file?</p> <p>Thanks for your help!</p> <p>edit:</p> <p>I got this working using the requests library:</p> <pre><code>params = {'redirect_uri':request.build_absolute_uri(reverse('profiles.views.fb_signup')), 'client_id':apis.Facebook.app_id, 'client_secret':apis.Facebook.app_secret, 'code':code} r = requests.get("https://graph.facebook.com/oauth/access_token",params=params) </code></pre> <p>However, I would still prefer to be dependent on a library when this should be supported natively without too much difficulty. Maybe this is asking too much...</p>
    singulars
    1. This table or related slice is empty.
    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.
    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