When ever the user logs in or signs up the api will send back a JWT which will need to be save to the users local storage. This will have to be passed in to every api call that the front end will make and if the user has been logged in to more that 2 hours the api will throw a specific error (Unauthorized 401 error). When this error is thrown, log out the user and redirect them to log back in.
in order to add this token to every api call, you will need to set an authentication header which should look like this:
headers: { 'Authorization': 'Bearer ' + <user-JWT-here>, 'content-type': 'application/json' }
When ever the user logs in or signs up the api will send back a JWT which will need to be save to the users local storage. This will have to be passed in to every api call that the front end will make and if the user has been logged in to more that 2 hours the api will throw a specific error (Unauthorized 401 error). When this error is thrown, log out the user and redirect them to log back in.
headers: { 'Authorization': 'Bearer ' + <user-JWT-here>, 'content-type': 'application/json' }
this is more of a reference than anything else