A serverless and stateless JWT authentication system for react app build using netlify function
First clone this repository.
$ git clone https://github.com/mirsahib/React-Serverless-Authentication.git
Install dependencies. Make sure you already have nodejs
& npm
installed in your system.
$ yarn install
After successfull installation run
$ netlify dev
Rename .env.example
to .env
and add your mongo db password and jwt token secret.Generate a strong password from here
REACT_APP_DB_PASSWORD = <Your mongodb atlas cluster password>
REACT_APP_JWT_TOKEN = <Your randomly generated password>
Base url : http://localhost:8888/
URL | Body | Response | Description |
---|---|---|---|
.netlify/functions/signup |
|
|
return userid id and email |
.netlify/functions/login |
|
|
return userid and email |
.netlify/functions/user |
none |
|
return userid and email |
.netlify/functions/auth |
none | {auth:status} |
return auth true or false |
NB: Use Postman to test the api