I need to logout and remove the token from session. How can I do this?
It is hard to say without any informations about your use case. There is no logout in a jwt auth system. You can set the expiration time lower or overwrite the token in the session with a invalid default. Laravel has the Session. One of the benefits of jwt is that you don't store any sessions or tokens in a database. I hope this is helpful.
Depending on your client implementation. You should remove the token from the client. E.g. delete it from localStorage or something (if you are running a single page app for example). Alongside this you should invalidate the token, so it can no longer be used e.g.
JWTAuth::invalidate($token);
Thanks. @tymondesigns ! This is what I need!
Most helpful comment
Depending on your client implementation. You should remove the token from the client. E.g. delete it from localStorage or something (if you are running a single page app for example). Alongside this you should invalidate the token, so it can no longer be used e.g.