Skip to content

Latest commit

 

History

History
58 lines (39 loc) · 2.59 KB

README.md

File metadata and controls

58 lines (39 loc) · 2.59 KB

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