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

empty request.env['omniauth.params'] causes exception #586

Closed
anklos opened this issue Mar 28, 2016 · 11 comments
Closed

empty request.env['omniauth.params'] causes exception #586

anklos opened this issue Mar 28, 2016 · 11 comments

Comments

@anklos
Copy link

anklos commented Mar 28, 2016

Hi there,

I open localhost:300/omniauth/facebook and authorize the app, then I see this error:

NoMethodError in DeviseTokenAuth::OmniauthCallbacksController#redirect_callbacks

undefined method `underscore' for nil:NilClass

in devise_token_auth (0.1.37) app/controllers/devise_token_auth/omniauth_callbacks_controller.rb:14:in `redirect_callbacks'

The line of the code is:

devise_mapping = request.env['omniauth.params']['resource_class'].underscore.gsub("/", "_").to_sym

I set a debugger there and found that request.env['omniauth.params'] is an empty hash {}.

Same issue happened for google oauth login.

Is there any omniauth params I miss in the setup?

Thanks!

@daudt
Copy link

daudt commented Apr 25, 2016

I'm getting the same error with facebook oauth. @anklos any luck solving this?

@anklos
Copy link
Author

anklos commented Apr 25, 2016

@daudt #540 (comment)

@anklos
Copy link
Author

anklos commented Apr 25, 2016

@daudt in summary, use /auth/facebook, not /omniauth/facebook. and pass auth_origin_url in the url query param

@daudt
Copy link

daudt commented Apr 25, 2016

@anklos Ok, so I've tried passing auth_origin_url both as a query param and as a header param and I'm still getting the same error. I'm using /auth/facebook:
NoMethodError (undefined methodunderscore' for nil:NilClass)`

@zachfeldman
Copy link
Contributor

Hi there @anklos @daudt ,

In an effort to cleanup this project and prioritize a bit, we're marking issues that haven't had any activity in a while with a "close-in-7-days" label. If we don't hear from you in about a week, we'll be closing this issue. Obviously feel free to re-open it at any time if it's the right time or this was done in error!

If you are still having the issue (especially if it's a bug report) please refer to our new Issue Template to provide some more details to help us solve it.

Hope all is well.

@caseyprovost
Copy link

caseyprovost commented Mar 2, 2018

I still have this issue on the latest tag v0.1.43.beta1. 0.1.42 was not working either. By this I mean when my redirect was issued to https://my.host/auth/saml/callback?resource_class=User I saw the following error.

screen shot 2018-03-02 at 5 10 24 pm

I should note this is on a rails api-only app using omniauth-saml

@mgs96
Copy link

mgs96 commented Mar 2, 2018

Same error as @caseyprovost here!

@yortz
Copy link

yortz commented Mar 9, 2018

same here, actually tried with several strategies, it looks like that request.env['omniauth.params'] is always nil, literally not clear why this is happening also commented about this here

@muhammadyana
Copy link

hallo, i still get error when i try access http://localhost:4001/users/auth/google_oauth2?auth_origin_url=localhost:4001/ it still error undefined method underscore for nil:NilClass
anyone can inform me where i have to locate the auth_origin_url ? thanks.
image

@yortz
Copy link

yortz commented Jun 13, 2019

@muhammadyana have you tried to configure the redirect-uri as described here? This solved my issue

@muhammadyana
Copy link

@yortz i have tried configure the redeirect_ui, in my devise.rb like
config.omniauth :twitter, ENV['TWITTER_CLIENT_ID'], ENV['TWITTER_CLIENT_SECRET'], redirect_uri: 'http://localhost:4001/users/auth/twitter/callback'
but it still error undefined method underscore for nil:NilClass
here the full code
image

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

No branches or pull requests

7 participants