mgh
mgh

Reputation: 1021

Implement JWT with devise or other user managment

I want use json web token in my new project. In this project, I use angularjs and ruby on rails in this project.

Now I want use jwt in project. Before I use devise for user management in back end server, but now I don't know is true that I use devise with jwt or not. By information that I find, devise is work by session, and one of the perpose of jwt is remove the session.

Question: Is it correct to use devise with jwt or I have to write a simple user management instead of devise and just save user information (email and password) on database?

Upvotes: 4

Views: 1550

Answers (1)

Jim Jeffers
Jim Jeffers

Reputation: 17930

I wrote the example that @pankas mentioned. You can see a screencast walkthrough here: https://www.youtube.com/watch?v=_CAq-F2icp4

In my example, we bypass the standard session management provided by devise and simply check the validity of the JWT. Now, why would you still use devise? Well you certainly don't have to. However, using devise you get a lot of other benefits for free right out of the box - mainly you get a reliable platform to handle user registration and authorization. That's why I worked to build a solution that integrated the two. I still use devise for everything else aside from the session management and that was reason enough to perform the integration. I hope this helps.

Upvotes: 2

Related Questions