-
Notifications
You must be signed in to change notification settings - Fork 126
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
Getting 401 Unauthorized on callback #65
Comments
Be careful with logging def stored_state
session.delete('omniauth.state')
end What does your authorize URI and callback URI look like? As a debug measure you may try to replace def stored_state
session['omniauth.state']
end and check what value it will show this way. |
I only started logging it once I got that 401. But if I just print out the whole session instead (before that delete is called), the session doesn't even contain And actually if I log the session when |
What does your authorization request URI and callback URI look like? You may stub domain name when posting these if it's an issue for you. |
/auth/:provider/callback(.:format) => sessions#create And the /auth/:provider which is built into the gem I believe |
No, by authorization URI I mean the URI you get redirected, when you access your For instance, given my OIDC client is |
Here is the config from the discovery:
PS: I'm using discovery |
It is not that significant what you've got in discovery, since it seems to pass well. When your client is in the request phase it must generate |
Is it not significant that I seem to have a different session on the callback than I did when making the request? |
The session must be the same, of course. But that got nothing to do with the discovery. The request is initiated after the discovery has been finished. |
I'm also going through an ngrok tunnel, or rather the provider is hitting On Nov 4, 2016 3:11 PM, "Senya" notifications@github.com wrote:
|
Do you initiate your authorization by hitting |
It's the same result when I do, it ends up with a new session on callback |
I think there must be something wrong either with your web application configuration or with your environment. Maybe some CSRF issue, for example (you must turn off CSRF verification for omniauth routes in Rails). I'd still compare authorization URI with callback URI to see whether the |
In the authorization URI, the state variable is set to true:
Callback request parameters are:
However, at this point my session has just a I imagine the issue has to do with the session resetting between auth and callback. |
I'm getting a 401 Unauthorized during the callback phase and it's not clear why. I'm wondering if I could have something wrong with my configuration or if there's an issue on the provider's side. The line it's failing on is this:
I've logged the variables in the if statement and see that
state
is present butstored_state
is empty. Why might this be?FWIW, here's my configuration:
Is there something I could be missing in my configuration?
Note that this is an integration with a 3rd party, not an established OpenID provider like Google or anything.
Thanks.
The text was updated successfully, but these errors were encountered: