Skip to content

lthong/web-authentication-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Web Authentication Example

Introduction

This project is an example of user authentication.

demo

For the demo, please check here!

Note: The demo of the project may be incomplete, because the server is set to be used locally, if you want to get the complete demo, please setup the project locally.

Client

The web authentication application using React and Redux.

cd client
yarn
yarn start

Server

Build a scaleable API with authentication using Express, Mongo, and Passport.

DB Setup

cd server
brew tap mongodb/brew
brew install mongodb-community@4.4
sudo mkdir -p /data/db
sudo chown -R  $USER /data/db
mongod

Server Setup

cd server
yarn
yarn run dev

Features

  • Home Page
    • Redirect to login page if user does not login
  • Login
    • Form Validation
    • User indentify
    • To keep token when reload page
  • Sing up
    • User is unique validation
    • Hash the password
    • Save the user models
    • Auto login if sing up successful
  • Logout
    • To clear token when logout
  • Authenication
    • Token generation when signin or signup successful
    • Token checking when a user gets some personal information