Search code examples
authenticationjwtfeathersjs

How to implement "remember me" feature in feathers.js and JWT


Feathers use JSON web token for auth. How can I conditionally set token's expiresIn property depends on "remember me" was checked or not.


Solution

  • The way to not remember a JWT is not to store it on the client side. If you are using the Feathers client with authentication the token is stored in localStorage as feathers-jwt. You can "unremember" it for the next browser session by calling

    localStorage.removeItem('feathers-jwt')