-
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
Using devise_token_auth with devise for one method #559
Comments
I'm afraid you can't, you will need to use a separate controller |
Alright, now I have two controllers two handle that. However, I'm having similar problem as described in the readme (see here). I have now created a 'ApiApplicationController' so the
inside the regular application_controller.rb won't stop us from authenticate via |
You can't, what you need to do is move your class DeviseController < ApplicationController
before_filter :authenticate_user! class SomeDeviseController < DeviseController class ApiController < ApplicationController
before_filter :authenticate_user! class SomeApiControlller < ApiController |
Sounds like we have a proposed solution. Closing for now. |
I have an app using devise and everything is working fine. Now I want to be able to access one controller function via token (preferably by using the devise_token_auth gem), but if there is no token in the header, normal devise should authenticate (just like it used to do). That is, everything should work like it did (normal devise login and so on) but we should also be able to send a request with appropriate headers , get a token and use that to call the function.
If I put the following line in the application controller,
I get the following body
Even though I create the api - v1 namespace / scope in routes.rb.
Is there anyway to use the regular devise just as normally but only use the DeviseTokenAuth for one method?
Thanks!
The text was updated successfully, but these errors were encountered: