GitHub OAuth strategy implementation using Express and PassportJS
Simple app with PassportJS middleware, GitHub strategy and OAuth verification
- Clone repository
git clone https://github.com/bee-joo/passportjs-github
- Install dependencies
npm install
- Configure environment
2.1. You can use dotenv for Node environment variables
2.2. Setup MongoDB
2.3. There is basic usage of MongoDB server -MONGO_ADDRESS
andMONGO_PORT
env variables. Use these variables in your dotenv file or refactor this line for your usage
2.4. Create an OAuth GitHub app (docs)
2.5. UseCLIENT_ID
andCLIENT_SECRET
env variables for client ID and secret. UseCALLBACK_URL
variable for your callback URL
2.6. Put your long secret string inSESSION_SECRET
env variable - Run app
npm start