HOSENUR
HOSENUR

Reputation: 461

Proper way to use JWT Auth in React

I have a php backend which takes mobile and password and returns the user info and an JWT access token if the user is valid, I have a React Web App which makes a request to the API, now should I store the JWT and user info in my local storage? and how do I validate that the JWT token stored is valid so that I can protect my private routes

Upvotes: 0

Views: 182

Answers (1)

Justinas
Justinas

Reputation: 43471

  1. Yes, you should persist JWT token to be used with any other request to server.
  2. Make request to back-end. There auth server will validate JWT signature (if it's signed with certificate)

Upvotes: 2

Related Questions