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

state param #8

Open
jnevelson opened this issue Oct 17, 2013 · 4 comments
Open

state param #8

jnevelson opened this issue Oct 17, 2013 · 4 comments

Comments

@jnevelson
Copy link

Having an issue implementing this gem for OAuth2 authentication. I've been getting errors when redirecting to LinkedIn's auth site. Upon investigating further, it seems that the state param is required[1] to be present in the URL.

I've gone through the source of this gem and see no reference to state. Using this PR #6 fixes the problem (when I pass in the state), but I'm confused about the implementation of it. The wording of it makes it seem like state is optional, but it says that it is required in LinkedIn's documentation. Am I missing something? How is this gem working for anybody in its current implementation?

Thanks!

[1]http://developer.linkedin.com/documents/authentication

@heythisisnate
Copy link
Collaborator

Sorry for the delayed response, I didn't see this until now.
I believe the state param is added automatically by OmniAuth::Strategies::OAuth2 which this gem's strategy inherits from. You shouldn't need to ever manually add it. See: https://github.com/intridea/omniauth-oauth2/blob/master/lib/omniauth/strategies/oauth2.rb#L53

Please be sure that you're using the latest version of the omniauth-oauth2 dependency along with this gem in your application. Let me know if this is still a problem.

@gaurav-shetty
Copy link

I am facing the same issue. I have a ROR app and I have included oauth2, ominauth and ominiauth-oauth2 gems in my gemfile so I am sure that the latest versions are being used. I was only able to fix this problem my manually setting the options.authorize_params[:state] in a lambda in the setup phase.

@jnevelson
Copy link
Author

@gaurav-shetty that is exactly what I ended up doing.

@Arepo
Copy link

Arepo commented Jan 24, 2019

I just encountered this problem too, but in my case I need to use the state param for its secondary 'round trip' purpose: https://auth0.com/docs/protocols/oauth2/oauth-state, so setting it at an application level doesn't make any sense

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

4 participants