avatar
expire token in Cookie Javascript

In real-world scenarios, it is important to check if the token has expired by verifying it with the server from the client-side. To do this, you can use the following JavaScript code to handle token expiration.

var now = new Date();
var pastDate = new Date(now.getTime() - 1000);
document.cookie = "auth.token=; expires=" + pastDate.toUTCString() + "; path=/";
Note: Use the browser console to execute the script above.
You need to login to do this manipulation!