-
Notifications
You must be signed in to change notification settings - Fork 403
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
NoAuthorizationCodeError when user cancels authorization with FB #192
Comments
Getting this as well using rails and devise_token_auth with omniauth-facebook |
And what's expected? Redirect to |
Hello @joker-777 @nbrustein! Actually it works when RACK_ENV is not set to development. see https://github.com/intridea/omniauth/blob/master/lib/omniauth.rb#L37, https://github.com/intridea/omniauth/blob/master/lib/omniauth.rb#L36 You can override that via |
In my opinion, it does not work when RACK_ENV is not set to development, because the error message passed through to the failure endpoint is no_authorization_code. This isn't really what went wrong. The real problem is that the user denied the authorization request. The fact that there is no authorization_code is just a symptom of that. It can have other reasons (for example, if someone goes to /auth/failure directly in a browser. I think that expected behavior should be to get forwarded to auth/failure with the error message saying user_denied. We're doing this in omniauth.rb right now to produce this behavior:
|
You can try example application in production mode. That works for me.
Open http://localhost:9292/server-side and try to reject. I'm redirected to |
But what is the error message? is it no_authorization_code? To me, that's a problem. That is a bad description of what went wrong. It's not specific enough. I think that the error code should tell you that the problem is that the user denied authorization, so that you can handle that specially if you want to. |
Why? I think |
To me, no_authorization_code is not good enough because it can come from other reasons (like going directly to /auth/failure). And because when I, as a developer, read it, it took me hours of reading through code and issues online before I understood that what that really meant was that the user had clicked "Cancel" when I asked them to give me their e-mail address. That's not clear at all. Let me say it another way. Facebook responded to my api request with a clear error message: user_denied. The facebook omniauth-gem, rather then sending that error message along to me, ate it and sent me a different error message, no_authorization_code. The original error message from facebook would have been a lot more clear and informative. That make sense? |
Sure, I understand you. Do you have any idea how similar omniauth libraries are handling this? |
With google_oauth2, I get to the the failure endpoint with params['message'] equal to "access_denied"' |
If you'll accept a PR for this, let me know and I'll get one together. |
@nbrustein PR welcome. |
Experiencing the same thing. This would be very valuable to us as we want to log the actual errors, and this is a red herring when troubleshooting oauth issues. |
This looked like a quick fix, using the same logic as in google_oauth2. Any particular reason it wasn't fixed (e.g. any other issues, backward compatibility)? |
@mkdynamic Hi, it would be nice if we could fix this issue. |
looking for this fix |
There is pull request opened for this (#309), we will continue discussion in there. I'm closing this for now. Thanks everyone for your comments here. |
The user can login via fb without problems but when he cancels the authorization on the fb popup we see the following unicorn log entries
We are confused about this error entry.
The text was updated successfully, but these errors were encountered: