Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AlexeyMK opened this issue Jun 13, 2012 · 2 comments
Open

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

AlexeyMK opened this issue Jun 13, 2012 · 2 comments

Comments

@AlexeyMK
Copy link

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
Copy link
Owner

Hi

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.

Cheers

@AlexeyMK
Copy link
Author

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants