Ask A Question


You’re not receiving notifications from this thread.

Token Auth API with Devise

Michael Stitt asked in Gems / Libraries

I just watched your screencast on using Devise for user authentication and learned quite a bit. However, I not only want to create a web app but I'd also like to provide a JSON API as another way to interact with the database. Do you think you could create a screencast where you show us how to go about doing something like this? I read through the comments and it looks like other people are looking for something similar.

I found an open-sourced app but I'd love to hear you walk us through why you're choosing to do different things.

I love your screencasts, keep pumping 'em out!


That app is pretty good and I've used Devise token_authenticatable in the past and it works pretty well. I'd recommend using as long as you don't need something complicated with your API tokens.

I think doing an episode on using token_authenticatable and one from scratch would be great. Are there any particular things you'd like to see covered in an episode?


I guess I'd just like to hear you point out any long-term considerations we should take into account when attempting to build API endpoints, as well as a web interface in the same Rails app.

I've read that it's advantageous to store API tokens in a Redis instance, is that feasible when using Devise?

I've never built a production-facing API so any advice/guidance would be much appreciated!


Here's a first episode on the topic! :)

API tokens in Redis would be useful for accessing them very quickly without hitting the database. Performance would be the primary reason here and you could also have them autoexpire using the built in Redis expiration functionality


Awesome! I'm looking forward to watching this when I get home.

Keep up the good work!


This was great, Chris! Keep up the good work!



Join the discussion
Create an account Log in

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

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

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