request.get_full_path() which returns the whole request including the ?
code=xxx which messed me up.
On Jan 26, 12:07 am, Matias Aguirre <matiasagui...@gmail.com> wrote:
> Hi,
>
> Is your request.get_host() the same defined in Facebook app settings? (Web site
> section if I can recall correctly), facebook doesn't accept 127.0.0.1 as
> redirect url and might not accept localhost too.
>
> Check social_auth/backends/facebook.py onhttps://github.com/omab/django-social-auth
> for an example.
>
> Regards,
> Matías
>
> Excerpts fromCrabbyPete'smessage of Wed Jan 26 00:39:05 -0200 2011:
>
> > I am going nuts this should be simple but I keep getting a
> > verification error every time in my response in the following code. I
> > double checked my APP_ID and SECRET I try the following code. I'm
> > using python2.5. Any help appreciated.
>
> > def login( request ):
>
> > parms = { 'client_id': settings.FACEBOOK_APP_ID,
> > 'redirect_uri': 'http://' + request.get_host() +
> > request.get_full_path()
> > }
>
> > if 'code' in request.GET:
> > parms['code'] = request.GET['code']
> > parms['client_secret'] = settings.FACEBOOK_APP_SECRET
> > url = 'https://graph.facebook.com/oauth/access_token?'+
> > urllib.urlencode(parms)
>
> > response = urllib.urlopen(url).read()
> > pdb.set_trace()
> > response =cgi.parse_qs(response)
>
> > if 'access_token' in response:
> > access_token = response['access_token'][0]
> > graph = GraphAPI( access_token )
> > profile = graph.get_object("me")
> > url = reverse('sites')
> > url = reverse('sites')
>
> > else:
> > parms['scope'] = 'email,user_location'
> > url = "https://graph.facebook.com/oauth/authorize?" +
> > urllib.urlencode(parms)
>
> > return HttpResponseRedirect(url)
>
> --
> Matías Aguirre <matiasagui...@gmail.com>
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment