Skip to content

passport/todos-express-openidconnect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

todos-express-openidconnect

This app illustrates how to use Passport with Express to sign users in via OpenID Connect. Use this example as a starting point for your own web applications.

Quick Start

To run this app, clone the repository and install dependencies:

$ git clone https://github.com/passport/todos-express-openidconnect.git
$ cd todos-express-openidconnect
$ npm install

This app must be configured with an OpenID Provider (OP)'s endpoints, as well as a client ID and secret that has been issued by the OP.

The endpoints should be set as options to OpenIDConnectStrategy in routes/auth.js.

Once the client ID and secret have been obtained, create a .env file and add the following environment variables:

CLIENT_ID=__INSERT_CLIENT_ID_HERE__
CLIENT_SECRET=__INSERT_CLIENT_SECRET_HERE__

Start the server.

$ npm start

Navigate to http://localhost:3000.

Overview

This example illustrates how to use Passport and the passport-openidconnect strategy within an Express application to sign users in via OpenID Connect.

This app implements the features of a typical TodoMVC app, and adds sign in functionality. This app is a traditional web application, in which all application logic and data persistence is handled on the server.

User interaction is performed via HTML pages and forms, which are rendered via EJS templates and styled with vanilla CSS. Data is stored in and queried from a SQLite database.

After users sign in, a login session is established and maintained between the server and the browser with a cookie. As authenticated users interact with the app, creating and editing todo items, the login state is restored by authenticating the session.

License

The Unlicense

Credit

Created by Jared Hanson