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

using devise_token_auth for API alongside standard devise gem for HTML view #689

Closed
knagode opened this issue Aug 1, 2016 · 2 comments
Closed

Comments

@knagode
Copy link

knagode commented Aug 1, 2016

I have a project which uses devise for authentication. Now we need an API. I am trying to use devise_token_auth for my API and standard devise for everything else.

First of all. Is this a good or bad idea?

I see that if I register user on html pages (which use devise) and then try to login with same credential on API (devise_token_auth) I receive:

{"errors":["Invalid login credentials. Please try again."]}

routes.rb

namespace :api, defaults: {format: :json}  do
  namespace :v1 do
    mount_devise_token_auth_for 'User', at: 'auth', skip: [:omniauth_callbacks]
  end
end

devise_for :users

@knagode
Copy link
Author

knagode commented Aug 1, 2016

I noticed that the problem was since I was wrapping email & password inside user block (this is how device works).

@knagode knagode closed this as completed Aug 1, 2016
@Jefferson210
Copy link

Hi @knagode , could you please help me as you have the configuration of the drivers, routes and models.
I've been trying for days to work together but I have not been able to achieve it

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

2 participants