Skip to content
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

Add the ability to store the token in the database/redis #100

Closed
dan-lutd opened this issue Jan 13, 2022 · 7 comments
Closed

Add the ability to store the token in the database/redis #100

dan-lutd opened this issue Jan 13, 2022 · 7 comments
Labels
enhancement New feature or request

Comments

@dan-lutd
Copy link

Summary

On sites with filesystems like Heroku, the file storage of generated files flushed every restart and at least every 24 hours.
For images ie user profile pic, AWS or other is suggested.
But for authentication I'd like to use the database or redis if needed to scale.
Each user may have multiple devices and therefor multiple rows in the token table.
For example token_id, token (hashed) user_id, device_id, device_name, platform

We would like to present a list of devices to the user and let them choose to unauthorize them.

@dan-lutd dan-lutd added the enhancement New feature or request label Jan 13, 2022
@eschricker
Copy link
Contributor

In my opinion, this functionality does not need to be included in the library.

You ca create a database table that contains all your tokens with the different claims. To do this, you need to change your login an refresh methods. If you want to unauthorize specific token, you can blacklist them. The functionality to blacklist tokens is implemented in this library.

@leon0399
Copy link
Member

The main cause for JWT is that it shouldn't be stored anywhere, but validated using cryptographic algorithms
Perhaps in your case you may look for other solutions

@Messhias
Copy link
Collaborator

I believe this issue should be not forwarded as peer @eschricker advised with @leon0399.

If you think should keep this request open feel free to open the issue again with more details and why should be added to the library.

@dan-lutd
Copy link
Author

I understand if that is the direction the developers want to go..
My use case uses the stored token record for all tokens for a user,
allowing a different token per device.
A user may then get a list of the other devices that have tokens and revoke that token by deleting it.
By just using the token blacklist I cannot see the other devices the user may use.

@mfn
Copy link
Contributor

mfn commented Jan 18, 2022

I think what you're looking for might a more feature-full implementation like https://laravel.com/docs/8.x/sanctum

@dan-lutd
Copy link
Author

Exactly what I settled on. thanks

@leon0399
Copy link
Member

A user may then get a list of the other devices that have tokens and revoke that token by deleting it.

This feature will be possible after #71

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants