Skip to main content

API TOKEN DEVISE

Gems / Libraries • Asked by Saul Felipe Ramirez

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.


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?


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?


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


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.


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.


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


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.


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 27,623+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.