0

I am new to React.js and have a need to maintain session of the application...lets say for 3 minutes.

Authentication is done by a third party (akamai) and i need to have the session management. Can someone guide me on this? Any github code/video? TIA

Rahul
  • 235
  • 2
  • 5
  • 14

1 Answers1

0

Typically I would not recommend you manage sessions on the front-end as it's easy to hack.

With JWT (JSON Web Tokens) you create a token on your backend and your front-end just requests the latest token. Inside that token will be info on whether that session is still active (you'd control what is returned).

Find a good JWT guide set it up, then from React you make a simple fetch command to get the JWT and then parse it and boot the user as necessary.

There was a similar question to yours asked earlier in the year, please see below:

What is the best way to manage a user's session in React?

Badrush
  • 1,247
  • 1
  • 17
  • 35