JHardisty333 / stickle-bricks

Final Group Project
1 stars 2 forks source link

Implement JWT authentication into - FE #31

Open ryma1738 opened 3 years ago

ryma1738 commented 3 years ago

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.

this is more of a reference than anything else

ryma1738 commented 3 years ago

Error handling on frontend could look as follows: `if (!response.ok) { if (response.statusCode === 401) {

} else if (response.statusCode === 500) { } else }`