Skip to content

passport/todos-express-twitter-oauth2-fes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

todos-express-twitter-oauth2

This app illustrates how to use Passport with Express to sign users in with Google. 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-twitter-oauth2.git
$ cd todos-express-twitter-oauth2
$ npm install

This app requires OAuth 2.0 credentials from Google, which can be obtained by setting up a project in Google API console. The redirect URI of the OAuth client should be set to 'http://localhost:3000/oauth2/redirect/twitter'.

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

GOOGLE_CLIENT_ID=__INSERT_CLIENT_ID_HERE__
GOOGLE_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-twitter-oauth20 strategy within an Express application to sign users in with Google via OAuth 2.0.

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