Skip to content

🔒 A serverless JWT authentication service for react app build using netlify function 🔒

License

Notifications You must be signed in to change notification settings

mirsahib/React-Serverless-Authentication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Serverless Authentication

Netlify Status Current Issues GitHub Forks GitHub stars GitHub license

Description

A serverless and stateless JWT authentication system for react app build using netlify function

Instructions

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

Database and Local environment setting

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>

API

Base url : http://localhost:8888/

URL Body Response Description
.netlify/functions/signup
  • username
  • password
  • UserID
  • email
return userid id and email
.netlify/functions/login
  • username
  • password
  • UserID
  • email
return userid and email
.netlify/functions/user none
  • UserID
  • email
return userid and email
.netlify/functions/auth none {auth:status} return auth true or false

NB: Use Postman to test the api

Medium Article

Part 1 Part 2

About

🔒 A serverless JWT authentication service for react app build using netlify function 🔒

Resources

License

Stars

Watchers

Forks