This is probably a very stupid question, but I looked at it for hours and cannot find what I am doing wrong.
I'm trying to use Python to authenticate using the Facebook API, but I am having problems requesting a user access token. Having received the code, I make a request https://graph.facebook.com/oauth/access_token as follows:
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()
In response, I get
{"error": {"message": "Missing parameter redirect_uri.", "type": "OAuthException", "code": 191}}
Any ideas what could go wrong? I have already verified that the redirect_uri being passed is in the application domain, but could it be a problem that it is locally local and this domain is simply redirected to the localhost file of my hosts?
Thank you for your help!
edit:
I got this working with a query library:
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)
However, I would still rather be library dependent when it should be supported initially without much difficulty. Perhaps it takes too much ...
user1462558
source share