Skip to content
Example entrance application using ExpressJS and PassportJS
HTML JavaScript CSS
Branch: master
Clone or download
Latest commit e73b5d8 Nov 25, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.scratch
docs/images
src v0.0.0 Nov 25, 2019
.editorconfig v0.0.0 Nov 25, 2019
.gitignore v0.0.0 Nov 25, 2019
LICENSE Initial commit Nov 25, 2019
README.md v0.0.0 Nov 25, 2019
package-lock.json v0.0.0 Nov 25, 2019
package.json v0.0.0 Nov 25, 2019

README.md

express-passport-entrance

Example entrance application using ExpressJS and PassportJS

Background

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.

Concept

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:

Profile Page

Setup

Installing the project is fairly straight forward:

  1. Pull down the repo (clone, fork, download, etc.);
  2. Install dependencies using npm install or npm i;
  3. Create an app with your social media's developer portal;
  4. Set the app's suppliedd APP_ID and SECRET using an environment variable.

Environment Variables

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:

Launch Configuration

Adding Providers

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:

Config File

Contact Info

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:

Fred Lackey
fred.lackey@gmail.com

You can’t perform that action at this time.