Skip to content

This is a NodeJS Starter template with Passport, Express Session, and Connect Mongo for authentication

Notifications You must be signed in to change notification settings

erxon/passport-auth-nodejs

Repository files navigation

Passport Authentication Template in NodeJS

This is a template for adding authentication in NodeJS using passport with sessions. It stores sessions in MongoDB database using MongoStore. The server.js has also necessary security implementations.

Environment Variables

MONGODB_URI This is the connection address into your database.
SALT_ROUNDS This will set how many times the password will be salted
PASSPORT_SECRET A signature consists of random character string that is appended to the sessionID

If you want to add Google Authentication you can add the following variables:

GOOGLE_CLIENT_ID
GOOGLE_CLIENT_SECRET

Contents

Instruction

  • Clone the repository in your local https://github.com/erxon/passport-auth-nodejs.git
  • Run npm i to install all the necessary packages
  • Set the necessary environment variables: MONGODB_URI, SALT_ROUNDS, and PASSPORT_SECRET
  • Execute npm run start in your terminal
  • That's it and enjoy

About

This is a NodeJS Starter template with Passport, Express Session, and Connect Mongo for authentication

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published