Example entrance application using ExpressJS and PassportJS
A friend was venturing into the world of software development and wanted to target MEAN / MERN. He was having difficulty wrapping his head around Passport and OAuth. This repo was the result of an afternoon "bootcamp" session to get him up to speed with the basics.
User is allowed to signup with a social media account (currently Facebook or Google). Once logged in, they may link or unlink an additional social media account. This allows them to login with either service and load same user account:
Installing the project is fairly straight forward:
- Pull down the repo (clone, fork, download, etc.);
- Install dependencies using
- Create an app with your social media's developer portal;
- Set the app's suppliedd
SECRETusing an environment variable.
This project was created using Visual Studio Code and the
.vscode folder was not checked in (personal preference). You will need to set the environment variables using
export or however your system requires. Here is a quick look at my VSCode launch configuration just in case you want to setup your machine like mine:
At the moment, this project is built to handle either Facebook, Google, or both. However, adding a PassportJS provider should be quite easy. Simply install the provider you want using
npm install (they are listed on passportjs.org) and then create a defintion object in the
config.js file similar to the following:
I'll be happy to help in any way I can. If you find a bug, or have a question which cannot be answered from the usual sources... Stack Overflow, Experts Exchange, CodeCall, etc.... feel free to drop me a line: