DEV Community

New React Developer Seeking Simple Authentication

bcinteractive on October 20, 2022

I am currently learning React + Slim PHP to create full stack app. I wanted to learn more about authentication/authorization. From what I read, J...
Collapse
 
brense profile image
Rense Bakker

You can use the jwt library itself, jwt was made by auth0: npmjs.com/package/jsonwebtoken
In your BE create a token by using the sign method, send it to the FE and put it in the request headers on each request to the BE then in the BE use the verify method to verify the token is valid.

Collapse
 
brense profile image
Rense Bakker

Oh and dont put secrets like the user password in the token. The contents of the token are visible in the FE.