Complete Authentication & Authorization
- SignUp/SignIn
- Email Confirmation
- Login with Facebook
- Login with Google
- Password reset with email
- Role based redirects (admin or user)
- Storing JWT in Cookie & user data on localstorage.
- Unverified users will be deleted automatially after 7 days.
- Toast notifiations
Client: React, Redux, Router, SCSS
Server: Node, Express, Mongoose
- Fork/clone or download project.
- Make sure you have Node.js, NPM installed in your system
- In the root folder type following commands:
npm i
cd client
npm i
- It is not necessary but recommended to install nodemon globally by
npm i -g nodemon
- You need to create following accounts:
-
Google Cloud Platform for google login.
-
Facebook Developer for facebook login.
-
(Optional: if you are using MongoDB locally ignore it)
MongoDB Atlas Account for mongo URI.
-
(OPTIONAL: Only if you are using sendgrid for Email)
SendGrid for sendgrid api key.
- Create two .env files one in project root folder & other in the client directories root folder. like this:
- Make sure to update the .env path in server.js. Replace
<YOUR_PATH>
&<PROJECT_NAME>
accordingly:
require("dotenv").config({
path: "<YOUR_PATH>/<PROJECT_NAME>/.env",
});
To run this project, you will need to add the following environment variables to your .env file
PROJECT ROOT DIRECTORY ENV
NODE_ENV = development
CLIENT_URL = "your client url: REMOVE DOUBLE QUOTES"
PORT = 5000
MONGO_URI = "your mongodb uri: REMOVE DOUBLE QUOTES"
EMAIL_TO = "recipient : REMOVE DOUBLE QUOTES"
EMAIL_FROM = "sender : REMOVE DOUBLE QUOTES"
SENDGRID_API_KEY = "your sendgrid apikey : REMOVE DOUBLE QUOTES"
JWT_SECRET = "random string : REMOVE DOUBLE QUOTES "
JWT_EXPIRE = "expire time : REMOVE DOUBLE QUOTES"
JWT_ACTIVATION_SECRET = "random string : REMOVE DOUBLE QUOTES"
JWT_ACTIVATION_EXPIRE = "expire time : REMOVE DOUBLE QUOTES"
JWT_RESET_PASSWORD_SECRET = "randm string : REMOVE DOUBLE QUOTES"
JWT_RESET_PASSWORD_EXPIRE = " expire time : REMOVE DOUBLE QUOTES"
GOOGLE_CLIENT_ID = "your google client id : REMOVE DOUBLE QUOTES"
CLIENT ROOT DIRECTORY ENV
REACT_APP_GOOGLE_CLIENT_ID = 'your google client id'
REACT_APP_FACEBOOK_APP_ID = 'your facebook app id'
To run the project locally, open CLI in server folder and client folder:
- In server CLI enter
nodemon server.js
- In client CLI enter
npm start
- Heroku postbuild script is added to package.json. No, need to build manually.
- Just install heroku and push.
MIT License
Copyright (c) [2021] [Ankush Dogra]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.