Reputation: 95
I am researching on how to create a blog website that allows a user to sign in and based on his/her user role they can edit blogs, delete blogs, etc. but only if they are the user that created that certain blog. However, another user can sign in and if he/she does not own a certain blog, they can only view the blog and not edit or delete. Before I dive deep into this project, I was wondering if JWTs would, by itself, be able to accomplish this mission or is there a better technology for this functionality? Thanks!
Upvotes: 0
Views: 37
Reputation: 142
Store user's role in your database and while generation fresh jwt for user set key/value pair describing user's role. That's it for role based Authorization using jwt.
This is nice short post related to role based Authorization using jwt
Upvotes: 1