flashingpumpkin/django-socialregistration — Issue #119: 500 error if Facebook user denies access to my app
Author: vlinhart
Created: 2011-10-29 15:06:11+00:00
State: open

Steps:
1. user clicks on connect button
2. when presented with your app FB confirmation/authorization dialog she declines the access
3. user is redirected back, but there is 500 error

This happens because GET parameter 'code' is required, but it's not in the address:
http://denikditete.cz/social/facebook/callback/?error_reason=user_denied&error=access_denied&error_description=The+user+denied+your+request.#_=_

Stack trace:
Traceback (most recent call last):

File "/home/denikditete/env/lib/python2.6/site-packages/django/core/handlers/base.py", line 111, in get_response
response = callback(request, *callback_args, **callback_kwargs)

File "/home/denikditete/env/lib/python2.6/site-packages/django/views/generic/base.py", line 47, in view
return self.dispatch(request, *args, **kwargs)

File "/home/denikditete/env/lib/python2.6/site-packages/django/views/generic/base.py", line 68, in dispatch
return handler(request, *args, **kwargs)

File "/home/denikditete/env/src/django-socialregistration/socialregistration/views.py", line 210, in get
client.complete(dict(request.GET.items()))

File "/home/denikditete/env/src/django-socialregistration/socialregistration/clients/oauth.py", line 281, in complete
return self.get_access_token(code=GET.get('code'))

File "/home/denikditete/env/src/django-socialregistration/socialregistration/clients/oauth.py", line 272, in get_access_token
raise ValueError(_('Invalid code.'))

ValueError:

,
POST:,