All Projects → passport → express-4.x-twitter-example

passport / express-4.x-twitter-example

Licence: Unlicense license
Express 4.x app using Passport for sign in with Twitter.

Programming Languages

CSS
56736 projects
javascript
184084 projects - #8 most used programming language
EJS
674 projects

Projects that are alternatives of or similar to express-4.x-twitter-example

graphql-server-typescript
GraphQL + MongoDB express server with JWT authorization (in Typescript!)
Stars: ✭ 48 (-53.4%)
Mutual labels:  passport
express-mongo-jwt-boilerplate
Express Mongo JsonWebToken boilerplate
Stars: ✭ 100 (-2.91%)
Mutual labels:  passport
peerai-api
Peerism's Peer.ai API built with Truffle, Node.js, Express.js, Solidity, and Ethereum TestRPC
Stars: ✭ 18 (-82.52%)
Mutual labels:  passport
seedpress-cms
A headless CMS built in Express for PostgresQL using Sequelize. Generally follows the Wordpress post and term schema.
Stars: ✭ 71 (-31.07%)
Mutual labels:  passport
auth-quickstart
Authentication Quickstart with Express, Passport and Sequelize
Stars: ✭ 49 (-52.43%)
Mutual labels:  passport
discord-dashboard
Example of Discord Oauth2 - Complete with Discord Bot
Stars: ✭ 35 (-66.02%)
Mutual labels:  passport
TradeByte
💸 TradeByte - Stocks Trading Simulation WebApp
Stars: ✭ 30 (-70.87%)
Mutual labels:  passport
passport-unique-token
Unique token authentication strategy for Passport
Stars: ✭ 35 (-66.02%)
Mutual labels:  passport
passport-local-knex
adding passport to a node app
Stars: ✭ 51 (-50.49%)
Mutual labels:  passport
laravel-sso-passport
[DEPRECATED] A simple SSO (Single Sign On) system using the Laravel Framework with Passport API Authentication
Stars: ✭ 27 (-73.79%)
Mutual labels:  passport
add-my-name
No more WhatsApp spams 🎉
Stars: ✭ 16 (-84.47%)
Mutual labels:  passport
passport-local-sequelize
passport-local-sequelize is a sequelize plugin for building username and password login with passport
Stars: ✭ 81 (-21.36%)
Mutual labels:  passport
todos-express-password
Todo app using Express and Passport for sign in with username and password.
Stars: ✭ 739 (+617.48%)
Mutual labels:  passport
todos-express-openidconnect
Todo app using Express, Passport, and SQLite for sign in via OpenID Connect.
Stars: ✭ 14 (-86.41%)
Mutual labels:  passport
passport-qq
QQ connection authentication strategy for Passport and Node.js
Stars: ✭ 33 (-67.96%)
Mutual labels:  passport
mern-boilerplate
A Full MERN Stack Boilerplate for Web Apps including a local authentication system. Uses React, Express.js, MongoDB, Redux, Passport.js, Webpack, Testing, and more.
Stars: ✭ 211 (+104.85%)
Mutual labels:  passport
express-mvp
Express.js project template ready to go
Stars: ✭ 21 (-79.61%)
Mutual labels:  passport
passport-oauth1
OAuth 1.0 authentication strategy for Passport and Node.js.
Stars: ✭ 23 (-77.67%)
Mutual labels:  passport
laravel-passport-socialite
The missing social authentication plugin (i.e. SocialGrant) for laravel passport.
Stars: ✭ 50 (-51.46%)
Mutual labels:  passport
laravel-api-boilerplate-passport
An API Boilerplate to create a ready-to-use REST API in seconds.
Stars: ✭ 20 (-80.58%)
Mutual labels:  passport

This example illustrates how to use Express 4.x and Passport to sign users in with Twitter. Use this example as a starting point for your own web applications.

Quick Start

To get started with this example, clone the repository and install the dependencies.

$ git clone [email protected]:passport/express-4.x-twitter-example.git
$ cd express-4.x-twitter-example
$ npm install

This example requires credentials from Twitter, which can be obtained by creating an app in the developer portal's App page. The callback URL of the app should be set to: http://localhost:3000/oauth/callback/twitter.com

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

TWITTER_CONSUMER_KEY={{INSERT_API_KEY_HERE}}
TWITTER_CONSUMER_SECRET={{INSERT_API_SECRET_KEY_HERE}}

Start the server.

$ npm start

Navigate to http://localhost:3000.

Overview

This example illustrates how to use Passport and the passport-twitter strategy within an Express application to sign users in with Twitter.

The example builds upon the scaffolding created by Express generator, and uses EJS as a view engine and plain CSS for styling. This scaffolding was generated by executing:

$ express --view ejs express-4.x-twitter-example

The example uses SQLite for storing user accounts. SQLite is a lightweight database that works well for development, including this example.

Added to the scaffolding are files which add authentication to the application.

  • boot/db.js

    This file initializes the database by creating the tables used to store user accounts and credentials.

  • boot/auth.js

    This file initializes Passport. It configures the Twitter strategy and supplies the serialization functions used for session management.

  • routes/auth.js

    This file defines the routes used for authentication. In particular, there are three routes used to authenticate with Twitter:

    • GET /login

      This route renders a page that prompts the user to sign in with Twitter.

    • GET /login/federated/twitter.com

      This route begins the authentication sequence by redirecting the user to Twitter.

    • POST /oauth/callback/twitter.com

      This route completes the authentication sequence when Twitter redirects the user back to the application. When a new user signs in, a user account is automatically created and their Twitter account is linked. When an existing user returns, they are signed in to their linked account.

License

The Unlicense

Deploy

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].