What to do with the authentication token when it arrives at the front?

Asked

Viewed 27 times

0

I’m developing a site with Laravel on the server (API) and angular on the front. To authenticate a user in the system, I recover the credentials (email and password) and, if the user exists and the password is correct, I return a token to the front (angular).

When this token is on the front, what should I do with this token? Store in some variable?

Any comment you can make to me about this is already of great help, even if on top. It already helps me to have a notion!

  • is next with this token you can store as a cookie in the browser and whenever the user updates the page you check if the token has expired if there is no such cookie in specific just informs that the user is not logged in, just a simple idea...

  • Got it. But in addition to storing it as a cookie in the browser, I can store it in a variable using the angular, it’s not?

  • Yes of course you can and you must

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.