Coder Social home page Coder Social logo

arabog / authreactmongo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from asantono/authreactmongo

0.0 1.0 0.0 1.18 MB

An application starting point with basic authentication built in. Login, Logout, Signup, Secure routes for specific users with difference clearance levels or tiered memberships

HTML 19.42% CSS 14.91% JavaScript 65.67%

authreactmongo's Introduction

AuthReactMongo

AuthReactMongo is an open source MERN stack template with built in authentication

  • Signup
  • Login
  • Logout
  • Built in Login/Signup form
  • Json Web Token
  • Secure Routes by user clearance
  • Secure Routes for logged in users
  • Redux Thunk Integration

Installation

Quick-Start Video Guide: https://www.youtube.com/watch?v=7KQTiQAwYSU

Clone or download the repository

In the .env file of the main folder:

  • Create a Mongodb database cluster at https://www.mongodb.com/
  • Retrieve your connection string from the "connect" button in your clusters home page
  • After clicking connect find "Connect your application"
  • Copy your connection string
  • Replace the text after "DATABASE:" with your Mongodb database connection string.
  • Change the JWT_SECRET *this is used to encode the JSON Web Token

AuthReactMongo has two nodemodules folders to populate In the project directory:

$ yarn
$ cd client yarn
$ cd ..
$ yarn
$ yarn run dev

.env

  • PORT = The port number of your server
  • DATABASE = Your Mongo database string
  • JWT_SECRET = The long string you use to encode your Json Web Token
  • JWT_EXPIRES = Length of time the JWT is good for ex: 14d = 14 days
  • JWT_EXPIRATION_NUM = Length of time the JWT is good for in milliseconds ex: 142460601000 = 14 days
  • NODE_ENV = 'dev' for development || 'production' for production

authController.secure

Purpose: Secure routes from users who are not logged in.

Usage: Place on or before routes that are only available to logged in users

App Example: In use before of the secret route in routes -> authRoutes

authController.clearanceLevel

Purpose: Secure routes from users who do not hold the proper 'Clearance' credentials in their user schema.

Usage: Define the clearance levels needed to retrieve the content in the function arguments. ex authController.clearanceLevel('level 1', 'level 2')

App Example: In use before of the secret route in routes -> authRoutes

authController.blacklist

Purpose: Create a list of keywords that are rejected from req.body

Usage: Remove keywords from req.body. ex: authController.blacklist('clearanceLevel', 'version')

App Example: In use before of the secret route in routes -> authRoutes

Tech

AuthReactMongo uses the following tech stack:

  • Mongodb
  • Express
  • React
  • Nodejs
  • Mongoose
  • Redux

Development

Want to contribute? Great!

Todos

  • Security settings
  • New features

License

MIT

authreactmongo's People

Contributors

asantono avatar papa-santo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.