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! :)
Clicking the “Remember Me” box tells the browser to save a cookie so that if you close out the window for the site without signing out, the next time you go back, you will be signed back in automatically. Make sure that you have your browser set to remember cookies, or this function will not work.
Remember Me? was checked you can leave the webpage without logging out and then be logged back in automatically if you visit the page again within the session timeout period (default is 30 minutes).
A username is almost always paired with a password. This username/password combination is referred to as a login, and is often required for users to log in to websites. For example, to access your e-mail via the Web, you are required to enter your username and password.
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.
You're asking for something that will need to be handled specifically for your case. The way most "remember me" systems work (including Laravel) is via storing a cookie on the user's device. That cookie is then used to authenticate automatically when the user returns. JWT is different as you are given a token, rather than a cookie, that you pass back to the server in a header. They are both essentially strings of letters and numbers, but you'll specifically have to store the JWT token on the user's browser in order for a "remember me" type of functionality. You might do this in the Angular app using localStorage or some other similar front-end practice.
For the forgotten password, you can submit the same form fields that are default to Laravel and simply override how the PasswordController returns the response; in this case needing a JSON response rather than a redirect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With