devise: undefined method `new_session_path` for omniauth_callbacks controller
this error appeared in our codebase since an upgrade from 1.3.4 to 1.4.8, and it seems somewhat related to similar errors reported recently. It consistently happens whenever an authorization is denied by the user and we end up on the failure side of the omniauth controller. Our code in callbacks controller is pretty much identical to that in the docs/wiki and worked fine in the past. We also see the error when hitting the recovery password page, similarly to an already reported and closed issue.
In our case the route code looks like
devise_for :users , :controllers => {
:omniauth_callbacks => "omniauth_callbacks" ,
:registrations => 'registrations',
:sessions =>'sessions'
}
and the quick fix was to simply add
def new_session_path *args
new_user_session_path *args
end
to our ApplicationController
About this issue
- Original URL
- State: closed
- Created 13 years ago
- Comments: 32 (15 by maintainers)
@printercu I agree.
Just updated https://github.com/plataformatec/devise/wiki/OmniAuth%3A-Overview#using-omniauth-without-other-authentications. Could you take a look?
Thanks.
@josevalim, got same issue on 3.2.4. Faced this problem when omniauth provider returns error and https://github.com/plataformatec/devise/blob/master/app/controllers/devise/omniauth_callbacks_controller.rb#L28 is called.
I use only
so seems like
new_session_pathhaven’t been generated.I have routes for
new_user_session_pathbut it doesn’t help:This fix works for me:
Should we reopen issue?
In the docs it says
but in fact it raises the aforementioned error and doesn’t use the root. I’m on a brand new Rails4 app with gems