-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comparing with jwt #140
Comments
With jwt I can check validity of token just by decrypting it, without comparing with token in database. Does devise_token_auth comparing and hitting database when you checking tokens for validity? |
I've made a conscious decision to compare the token with the database for each request. The main reason is for access control. For example, if a user's account has been disabled since their last login, the only way to know would be to check against the database. |
I understand, but it is heavy constraint. For example, let's imagine chat application, when you send message you can checked access control for thread by passing user_id and check manually if this id present in thread permissions, that's way you only need read thread and insert message, but with this approach i need load user for every request. This can become issue with scaling as you have more users and requests. |
There are other issues as well.
I would be open to de-coupling the validation system so that it can be easily overridden (using jwt or anything else). Feel free to send me a PR. |
Thanks for answers, I'm trying wrap my head around this issues to have best from both worlds. |
There's a good discussion about this here if you're interested. |
We encrypt token not a password, and only we can decrypt because we have secret key. So hashing token doesn't make sense. I think :) |
Hi, great gem.
I'm have just one question. How this gem architecture compared to json web tokens? And one more, when exactly a request hit the database?
The text was updated successfully, but these errors were encountered: