Reputation: 21593
I am creating an API using rails. When a user logs in (passes in username/password), rather than setting a cookie, I want to respond with a 'token' that I want to send the client. This token probably has an expiration date on it and the user_id i store internally which links the token with the user, etc. Is there a tutorial or gem I can use? Thanks
Upvotes: 0
Views: 82
Reputation: 14913
Railscasts.com has a wonderful episode dedicated to the same issue, worth checking it out.
Upvotes: 1
Reputation: 2474
If you're just looking for a way to send a token (not a gem that takes care of the whole process), you can use render inline: "token"
(or a json equivalent)
Upvotes: 0