Initial file setup for login/signup of user using passport.js and express. Also includes OAuth2 authentication.
The previous commits use different authentication methods such as:
- Using Mongoose encryption
- Hashing using md5
- Hashing and Salting with bcrypt
- Cookies and Sessions using passport.js
The recent HEAD points to OAuth2 Authentication from third party applications.
You can always go to a previous commit and use that particular authentication method.
-
Clone the repository or simply download the zip file.
-
Use the package manager npm to install Authentication.
npm install
Create a .env file in the root directory and add paste the following code snippet:
SECRET=SomeRandomStringToStoreYourSecret
MONGO_URI=---Mongo DB Url---
GOOGLE_CLIENT_ID=---Google Client ID---
GOOGLE_CLIENT_SECRET=---Google Client Secret---
FACEBOOK_CLIENT_ID=---Facebook Client ID---
FACEBOOK_CLIENT_SECRET=---Facebook Client Secret---
GITHUB_CLIENT_ID=---GitHub Client ID---
GITHUB_CLIENT_SECRET=---GitHub Client Secret---
Change the Mongo DB Url and your Client ID and Client Secret for OAuth2 authentication.
npm start
Server starts listening at localhost:3000