Issue
So far I have created a database with
user_id,token.
It stores all the logged in user's token.
I have fetched all the tokens from database by user_id. Then loop through,
JWTAuth::invalidate(new \Tymon\JWTAuth\Token($token->token));
Its not working. Third party package: Tymon Laravel JWT
How to achieve this functionality?
Solution
Just adding here the comment of Harpal singh.It solved my issue.
"you can create a middleware to check if account is deactivated then add
JWTAuth::invalidate(new \Tymon\JWTAuth\Token($token->token));
to invalidate the user. By doing this if deactivated user trying to access routes, he will not get access."
Answered By - Shifat
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.