Jwt-auth: Get All active tokens [ Need help ]

Created on 28 Feb 2017  路  1Comment  路  Source: tymondesigns/jwt-auth

I have gone through documentation but i haven't found method which return all active tokens . I need to implement invoking user token functionality. I can do it by managing tokens in database but i don't need that overhead . I am just a beginner in Laravel please give any valuable feedback .

Most helpful comment

I don't believe you can. Tokens are only persisted (in cache) when they are blacklisted. Tokens are validated by checking there signature so it is not necessary to persist each token created.

If you want to revoke user token functionality (blacklist) you need to know the token. Im not sure what your use case is but it sounds like there is a better way to do what you are trying to do.

Idea: if you simply want to revoke a token for specific user, consider adding the user ids to cache or a database and create middleware to check each parsed token to see if that user needs to have their token blacklisted in which case you now have the token to black list. See #1016

>All comments

I don't believe you can. Tokens are only persisted (in cache) when they are blacklisted. Tokens are validated by checking there signature so it is not necessary to persist each token created.

If you want to revoke user token functionality (blacklist) you need to know the token. Im not sure what your use case is but it sounds like there is a better way to do what you are trying to do.

Idea: if you simply want to revoke a token for specific user, consider adding the user ids to cache or a database and create middleware to check each parsed token to see if that user needs to have their token blacklisted in which case you now have the token to black list. See #1016

Was this page helpful?
0 / 5 - 0 ratings

Related issues

loic-lopez picture loic-lopez  路  3Comments

hfalucas picture hfalucas  路  3Comments

marciomansur picture marciomansur  路  3Comments

lbottoni picture lbottoni  路  3Comments

CBR09 picture CBR09  路  3Comments