Search code examples
angularjslaraveljwtremember-meforgot-password

Remember Users & Forgot Password Functionality in Laravel 5.1 and Angular JS (JWT Authentication)


I am using laravel 5 and angular js and JWT authentication for logging and registering my users. But there is nothing mentioned about to facilitate users with remember me functionality and also allow users to reset password when forgotten password.

I researched a lot and didn't find exactly what I need though the answer in following link is helpful but inadequate for me to proceed. Laravel 5 Password Reset with Angular View

Kindly provide any information and links that would be helpful. Thanks in advance! :)


Solution

  • To Answer from a JWT perspective.

    Remember me is essentially asking the user how long they want to login for. Depending on the security requirements and typical usage patterns of your users, short sessions are often from 15 minutes and up to a browser session. Long sessions (selecting Remember me) can be anything from 24hours to a year.

    The JWT issuer can set the exp claim (expiration time of the token) differently depending on the user's selection of the 'Remember Me' checkbox.

    If you're intending the 'Remember Me' to last longer than a single browser session, the simplest way is to store the token in a cookie. This means the cookie also needs to have the following properties set: httponly, secure, and expires (with the same expiry time as the exp claim from the token).

    Rest Password implementations come in many shapes and sizes depending on your requirements. These are not directly related to JWTs as they come before the JWT issuer will issue a token.