-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
NoMethodError (undefined method `name' for nil:NilClass) - devise_controller.rb:22 #134
Comments
What do the request and response headers look like? This can be found in the "network" tab of your web inspector. |
@lynndylanhurley the response tab was a bunch of html code that looked like usual rails exception errors, so I am not sure this is what you need, however, I'll post the info I have step by step:
https://gist.github.com/rmagnum2002/8f86bcfb84d3f64ce2cc
https://gist.github.com/rmagnum2002/93be6c4ab7ca20f66104 Nothing to show when I navigate through pages, it's all angular and I have the sign out link in the menu, so I assume sign in works as expected.
|
I had this same problem when mounting under a namespace (/api/v1 in my case). The problem disappeared after moving the devise mounting out of the namespace. |
Hi, |
+1 |
2 similar comments
+1 |
+1 |
+1. @aihaddad's solution works, but that hardly sounds like the way it should be. |
I'm getting this problem as well. Moving the devise mounting out of the namespace, gets me past the "undefined method `name' for nil:NilClass" error. But the validate request is stopped at a different error: "ArgumentError (wrong number of arguments (2 for 1)):" Gist with my routes.rb file : Gist with the console output: I've been trying to get ng_token_auth and devise_token_auth to work all week. Love the work you're doing, please help! |
Also here are my versions:
|
I think you need to revise your route to "/auth" instead of "auth" |
As it turned out, my bug was not the fault of devise_token_auth. Other git branches of my app (which use the original devise gem) were giving me the same "wrong number of arguments" error. So the problem was with a dependent gem somewhere. Clearing gems and re-bundling solved the problem. |
I experienced the same issue in regard to the /api/v1/ namespace. I moved the mount line from within the namespace in routes...:
...to outside of the namespace while referencing the correct path:
|
when I move it out of the namespace as @dkoloditch suggested, the before_filter authenticate_user! conflicts with that of devise. Is there any other way to resolve this issue? |
@dkoloditch thaanks for the solution. It works. |
I'm experiencing exact same problems @xanthfan had. When devise_token is mounted under a namespace, I get logged out after page refresh, and when it's outside I hit:
However, my Gemfile is almost empty and I continue failing on making this work. Any help appreciated. |
+1 for @dkoloditch solution |
Solution provided by @dkoloditch works. If you however encounter following error:
like I and @xanthfan did, clear up your cookies. I had cookies set up by other application using older devise which were causing this. |
The namespaced auth route issue is also discussed in #219 |
Hi there @rmagnum2002 , 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. |
Scenario - I log in successfully, and navigate through pages as a logged in user until I hit refresh.
Happens with this line:
# config.change_headers_on_each_request = true
commented, uncommented, set to true or false.. all cases.
line 22 from devise_controller:
The text was updated successfully, but these errors were encountered: