Jwt-auth: How to logout?

Created on 8 Mar 2015  路  3Comments  路  Source: tymondesigns/jwt-auth

I need to logout and remove the token from session. How can I do this?

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.

JWTAuth::invalidate($token);

All 3 comments

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hfalucas picture hfalucas  路  3Comments

NaelsonBrasil picture NaelsonBrasil  路  3Comments

johncloud200 picture johncloud200  路  3Comments

functionpointdaniel picture functionpointdaniel  路  3Comments

heroghost picture heroghost  路  3Comments