Ask A Question

Notifications

You’re not receiving notifications from this thread.

API TOKEN DEVISE

Saul Felipe Ramirez asked in Gems / Libraries

Hi, I have a question about which gem is better, devise_token_auth or devise_token_authenticatable?. I see that devise_token_auth was update recently while the other not.

Reply

Hey Saul,

I've never actually used devise_token_auth but it sounds like it might do the same thing. I'm not entirely sure. It seems to do the same thing as devise_token_authenticatable but provides more functionality. It definitely seems to be helpful if you're using React or Angular.

I guess maybe the best question is what are you trying to accomplish?

Reply

I am trying implement an API with Rails it will be used in AngularJS, IOS Application and Android Application. Do you have any recommendation to make it?

Reply

Ah perfect. In that case, I think you'd be best off with devise_token_auth. It's designed more for that use case.

Reply

Hello.
I chose the way with devise_token_auth too, but I am having problems with running devise_token_auth and Devise simultaneously. In my routes.rb I have API namespace which I want to be authenticated by devise_token_auth. It often works, but Devise sometimes (randomly) takes control and blocks (401 Unauthorized) my requests.

Did somebody encounter similar issue? I am not yet skilled with Rails and have no idea how to solve it. I am grateful for any advice.

Reply

Ján, that's pretty interesting. I would suggest creating a Github Issue on devise_token_auth and explaining your problem there. Hopefully the author will see it and be able to help out. I'm not familiar enough with the gem to help unfortunately.

Reply

Thanks for advice, Chris. Afterall I decided to implement my own Token authentization.

Reply

Hi Ján,

Can you share your code on Github? I'm also trying to build a Rails API that uses Devise for user authentication.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 87,563+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.