Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

No easy way to add callback for user rejecting auth in Facebook #158

AlexeyMK opened this Issue Jun 13, 2012 · 2 comments


None yet
2 participants

To Replicate: Send user to auth dialog in facebook, click "cancel" instead of go to app.
Expected: we have some way to declare where to send the user in such a case (perhaps a page offering alternate auth solutions)
Actual: A very simple template is rendered, displaying a generic error.

I've scoured the interwebs, and as far as I can tell there isn't a consistent way to enter an "on-user-rejects-terms" callback. I've created a hack in my local fork for now, but a generic solution would be welcome.

How I solved it:

  • turn session['next'] from a string to a dictionary with error and success keys.
  • in views, catch the OAuth Error of "access denied" and redirect it to self.get_error_redirect()
  • in Facebook Callback, implement get_error_redirect to call get_error_next, from mixins
  • in mixins, add get_error_next next to get_next, which looks for session['next']['error'](adjust get_next to use session['next']['success'])

flashingpumpkin commented Jun 13, 2012


I'd rather not fiddle with session['next'] but catching the specific access_denied is easy. Ideally that should happen on a per-services basis, eg in socialregistration.contrib.facebook.

On the other hand it would be useful to have a method get_denied_redirect that comes with a sensible default for every service though.

If you solve(d) it, please send a pull request. I've been thinking about this too.


My hack is currently pretty specific to our app, but I'll try to factor it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment