passport banner

Passport

Passport is Express-compatible authentication middleware for Node.js.

Passport's sole purpose is to authenticate requests, which it does through an extensible set of plugins known as strategies. Passport does not mount routes or assume any particular database schema, which maximizes flexibility and allows application-level decisions to be made by the developer. The API is simple: you provide Passport a request to authenticate, and Passport provides hooks for controlling what occurs when authentication succeeds or fails.


Sponsors

Your app, enterprise-ready.
Start selling to enterprise customers with just a few lines of code. Add Single Sign-On (and more) in minutes instead of months.



Drag and drop your auth
Add authentication and user management to your consumer and business apps with a few lines of code.



Auth. Built for Devs, by Devs
Add login, registration, SSO, MFA, and a bazillion other features to your app in minutes. Integrates with any codebase and installs on any server, anywhere in the world.



API-first AuthN, AuthZ, and Fraud Prevention
The most powerful identity platform built for developers. Easily build and secure a modern auth flow with user & org management, multi-tenant SSO, MFA, RBAC, device fingerprinting, and more.


Status: Build Coverage Dependencies

Install

$ npm install passport

Usage

Strategies

Passport uses the concept of strategies to authenticate requests. Strategies can range from verifying username and password credentials, delegated authentication using OAuth (for example, via Facebook or Twitter), or federated authentication using OpenID.

Before authenticating requests, the strategy (or strategies) used by an application must be configured.

passport.use(new LocalStrategy(
  function(username, password, done) {
    User.findOne({ username: username }, function (err, user) {
      if (err) { return done(err); }
      if (!user) { return done(null, false); }
      if (!user.verifyPassword(password)) { return done(null, false); }
      return done(null, user);
    });
  }
));

There are 480+ strategies. Find the ones you want at: passportjs.org

Sessions

Passport will maintain persistent login sessions. In order for persistent sessions to work, the authenticated user must be serialized to the session, and deserialized when subsequent requests are made.

Passport does not impose any restrictions on how your user records are stored. Instead, you provide functions to Passport which implements the necessary serialization and deserialization logic. In a typical application, this will be as simple as serializing the user ID, and finding the user by ID when deserializing.

passport.serializeUser(function(user, done) {
  done(null, user.id);
});

passport.deserializeUser(function(id, done) {
  User.findById(id, function (err, user) {
    done(err, user);
  });
});

Middleware

To use Passport in an Express or Connect-based application, configure it with the required passport.initialize() middleware. If your application uses persistent login sessions (recommended, but not required), passport.session() middleware must also be used.

var app = express();
app.use(require('serve-static')(__dirname + '/../../public'));
app.use(require('cookie-parser')());
app.use(require('body-parser').urlencoded({ extended: true }));
app.use(require('express-session')({ secret: 'keyboard cat', resave: true, saveUninitialized: true }));
app.use(passport.initialize());
app.use(passport.session());

Authenticate Requests

Passport provides an authenticate() function, which is used as route middleware to authenticate requests.

app.post('/login', 
  passport.authenticate('local', { failureRedirect: '/login' }),
  function(req, res) {
    res.redirect('/');
  });

Strategies

Passport has a comprehensive set of over 480 authentication strategies covering social networking, enterprise integration, API services, and more.

Search all strategies

There is a Strategy Search at passportjs.org

The following table lists commonly used strategies:

Strategy Protocol Developer
Local HTML form Jared Hanson
OpenID OpenID Jared Hanson
BrowserID BrowserID Jared Hanson
Facebook OAuth 2.0 Jared Hanson
Google OpenID Jared Hanson
Google OAuth / OAuth 2.0 Jared Hanson
Twitter OAuth Jared Hanson
Azure Active Directory OAuth 2.0 / OpenID / SAML Azure

Examples

Related Modules

The modules page on the wiki lists other useful modules that build upon or integrate with Passport.

License

The MIT License

Copyright (c) 2011-2021 Jared Hanson <https://www.jaredhanson.me/>

jaredhanson/passport

{
"props": {
"initialPayload": {
"allShortcutsEnabled": false,
"path": "/",
"repo": {
"id": 2540368,
"defaultBranch": "master",
"name": "passport",
"ownerLogin": "jaredhanson",
"currentUserCanPush": false,
"isFork": false,
"isEmpty": false,
"createdAt": "2011-10-08T22:38:32.000Z",
"ownerAvatar": "https://avatars.githubusercontent.com/u/10355?v=4",
"public": true,
"private": false,
"isOrgOwned": false
},
"currentUser": null,
"refInfo": {
"name": "master",
"listCacheKey": "v0:1701125857.0",
"canEdit": false,
"refType": "branch",
"currentOid": "0575de90dc0e76c1b8ca9cc676af89bd301aec60"
},
"tree": {
"items": [
{
"name": ".github",
"path": ".github",
"contentType": "directory"
},
{
"name": "etc",
"path": "etc",
"contentType": "directory"
},
{
"name": "lib",
"path": "lib",
"contentType": "directory"
},
{
"name": "sponsors",
"path": "sponsors",
"contentType": "directory"
},
{
"name": "test",
"path": "test",
"contentType": "directory"
},
{
"name": ".gitignore",
"path": ".gitignore",
"contentType": "file"
},
{
"name": ".jshintrc",
"path": ".jshintrc",
"contentType": "file"
},
{
"name": ".npmignore",
"path": ".npmignore",
"contentType": "file"
},
{
"name": ".travis.yml",
"path": ".travis.yml",
"contentType": "file"
},
{
"name": "CHANGELOG.md",
"path": "CHANGELOG.md",
"contentType": "file"
},
{
"name": "CONTRIBUTING.md",
"path": "CONTRIBUTING.md",
"contentType": "file"
},
{
"name": "LICENSE",
"path": "LICENSE",
"contentType": "file"
},
{
"name": "Makefile",
"path": "Makefile",
"contentType": "file"
},
{
"name": "README.md",
"path": "README.md",
"contentType": "file"
},
{
"name": "SPONSORS.md",
"path": "SPONSORS.md",
"contentType": "file"
},
{
"name": "package.json",
"path": "package.json",
"contentType": "file"
}
],
"templateDirectorySuggestionUrl": null,
"readme": null,
"totalCount": 16,
"showBranchInfobar": false
},
"fileTree": null,
"fileTreeProcessingTime": null,
"foldersToFetch": [],
"treeExpanded": false,
"symbolsExpanded": false,
"isOverview": true,
"overview": {
"banners": {
"shouldRecommendReadme": false,
"isPersonalRepo": false,
"showUseActionBanner": false,
"actionSlug": null,
"actionId": null,
"showProtectBranchBanner": false,
"publishBannersInfo": {
"dismissActionNoticePath": "/settings/dismiss-notice/publish_action_from_repo",
"releasePath": "/jaredhanson/passport/releases/new?marketplace=true",
"showPublishActionBanner": false
},
"interactionLimitBanner": null,
"showInvitationBanner": false,
"inviterName": null
},
"codeButton": {
"contactPath": "/contact",
"isEnterprise": false,
"local": {
"protocolInfo": {
"httpAvailable": true,
"sshAvailable": null,
"httpUrl": "https://github.com/jaredhanson/passport.git",
"showCloneWarning": null,
"sshUrl": null,
"sshCertificatesRequired": null,
"sshCertificatesAvailable": null,
"ghCliUrl": "gh repo clone jaredhanson/passport",
"defaultProtocol": "http",
"newSshKeyUrl": "/settings/ssh/new",
"setProtocolPath": "/users/set_protocol"
},
"platformInfo": {
"cloneUrl": "https://desktop.github.com",
"showVisualStudioCloneButton": false,
"visualStudioCloneUrl": "https://windows.github.com",
"showXcodeCloneButton": false,
"xcodeCloneUrl": "https://developer.apple.com",
"zipballUrl": "/jaredhanson/passport/archive/refs/heads/master.zip"
}
},
"newCodespacePath": "/codespaces/new?hide_repo_select=true&repo=2540368"
},
"popovers": {
"rename": null,
"renamedParentRepo": null
},
"commitCount": "625",
"overviewFiles": [
{
"displayName": "README.md",
"repoName": "passport",
"refName": "master",
"path": "README.md",
"preferredFileType": "readme",
"tabName": "README",
"richText": "<article class=\"markdown-body entry-content container-lg\" itemprop=\"text\"><p dir=\"auto\"><a href=\"http://passportjs.org\" rel=\"nofollow\"><img src=\"https://camo.githubusercontent.com/f612a1c558b4410a7a922e211c563b05b914f30a1e89cb74ef20de2d4719ffa3/687474703a2f2f63646e2e61757468302e636f6d2f696d672f70617373706f72742d62616e6e65722d6769746875622e706e67\" alt=\"passport banner\" data-canonical-src=\"http://cdn.auth0.com/img/passport-banner-github.png\" style=\"max-width: 100%;\"></a></p>\n<div class=\"markdown-heading\" dir=\"auto\"><h1 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\">Passport</h1><a id=\"user-content-passport\" class=\"anchor\" aria-label=\"Permalink: Passport\" href=\"#passport\"><svg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"></path></svg></a></div>\n<p dir=\"auto\">Passport is <a href=\"http://expressjs.com/\" rel=\"nofollow\">Express</a>-compatible authentication\nmiddleware for <a href=\"http://nodejs.org/\" rel=\"nofollow\">Node.js</a>.</p>\n<p dir=\"auto\">Passport's sole purpose is to authenticate requests, which it does through an\nextensible set of plugins known as <em>strategies</em>. Passport does not mount\nroutes or assume any particular database schema, which maximizes flexibility and\nallows application-level decisions to be made by the developer. The API is\nsimple: you provide Passport a request to authenticate, and Passport provides\nhooks for controlling what occurs when authentication succeeds or fails.</p>\n<hr>\n<p align=\"center\" dir=\"auto\">\n <sup>Sponsors</sup>\n <br>\n <a href=\"https://workos.com/?utm_campaign=github_repo&amp;utm_medium=referral&amp;utm_content=passport_js&amp;utm_source=github\" rel=\"nofollow\"><img src=\"https://raw.githubusercontent.com/jaredhanson/passport/master/sponsors/workos.png\" style=\"max-width: 100%;\"></a><br>\n <a href=\"https://workos.com/?utm_campaign=github_repo&amp;utm_medium=referral&amp;utm_content=passport_js&amp;utm_source=github\" rel=\"nofollow\"><b>Your app, enterprise-ready.</b><br>Start selling to enterprise customers with just a few lines of code. Add Single Sign-On (and more) in minutes instead of months.</a>\n <br>\n <br>\n <a href=\"https://www.descope.com/?utm_source=PassportJS&amp;utm_medium=referral&amp;utm_campaign=oss-sponsorship\" rel=\"nofollow\">\n <themed-picture data-catalyst-inline=\"true\"><picture>\n <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/jaredhanson/passport/master/sponsors/descope-dark.svg\">\n <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/jaredhanson/passport/master/sponsors/descope.svg\">\n <img src=\"https://raw.githubusercontent.com/jaredhanson/passport/master/sponsors/descope.svg\" width=\"275\">\n </picture></themed-picture>\n </a><br>\n <a href=\"https://www.descope.com/?utm_source=PassportJS&amp;utm_medium=referral&amp;utm_campaign=oss-sponsorship\" rel=\"nofollow\"><b>Drag and drop your auth</b><br>Add authentication and user management to your consumer and business apps with a few lines of code.</a>\n <br>\n <br>\n <a href=\"https://fusionauth.io/?utm_source=passportjs&amp;utm_medium=referral&amp;utm_campaign=sponsorship\" rel=\"nofollow\"><img src=\"https://raw.githubusercontent.com/jaredhanson/passport/master/sponsors/fusionauth.png\" width=\"275\" style=\"max-width: 100%;\"></a><br>\n <a href=\"https://fusionauth.io/?utm_source=passportjs&amp;utm_medium=referral&amp;utm_campaign=sponsorship\" rel=\"nofollow\"><b>Auth. Built for Devs, by Devs</b><br>Add login, registration, SSO, MFA, and a bazillion other features to your app in minutes. Integrates with any codebase and installs on any server, anywhere in the world.</a>\n <br>\n <br>\n <a href=\"https://stytch.com?utm_source=oss-sponsorship&amp;utm_medium=paid_sponsorship&amp;utm_campaign=passportjs\" rel=\"nofollow\">\n <themed-picture data-catalyst-inline=\"true\"><picture>\n <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/jaredhanson/passport/master/sponsors/stytch-dark.png\">\n <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/jaredhanson/passport/master/sponsors/stytch.png\">\n <img src=\"https://raw.githubusercontent.com/jaredhanson/passport/master/sponsors/stytch.png\" width=\"275\">\n </picture></themed-picture>\n </a><br>\n <a href=\"https://stytch.com?utm_source=oss-sponsorship&amp;utm_medium=paid_sponsorship&amp;utm_campaign=passportjs\" rel=\"nofollow\"><b>API-first AuthN, AuthZ, and Fraud Prevention</b><br>The most powerful identity platform built for developers. Easily build and secure a modern auth flow with user &amp; org management, multi-tenant SSO, MFA, RBAC, device fingerprinting, and more.</a>\n</p>\n<hr>\n<p dir=\"auto\">Status:\n<a href=\"https://travis-ci.org/jaredhanson/passport\" rel=\"nofollow\"><img src=\"https://camo.githubusercontent.com/ef13a5d49b50c0268799c8af289ee13f791ea2f34c592edd699b931f62dd1c6b/68747470733a2f2f7472617669732d63692e6f72672f6a6172656468616e736f6e2f70617373706f72742e7376673f6272616e63683d6d6173746572\" alt=\"Build\" data-canonical-src=\"https://travis-ci.org/jaredhanson/passport.svg?branch=master\" style=\"max-width: 100%;\"></a>\n<a href=\"https://coveralls.io/r/jaredhanson/passport\" rel=\"nofollow\"><img src=\"https://camo.githubusercontent.com/2e610f13bf2e452d0de59452b2383784dd2729a40f4bef638002c013ab759e6c/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6a6172656468616e736f6e2f70617373706f72742f62616467652e7376673f6272616e63683d6d6173746572\" alt=\"Coverage\" data-canonical-src=\"https://coveralls.io/repos/jaredhanson/passport/badge.svg?branch=master\" style=\"max-width: 100%;\"></a>\n<a href=\"https://david-dm.org/jaredhanson/passport\" rel=\"nofollow\"><img src=\"https://camo.githubusercontent.com/08aac7153abe9d4b07c77e0570cb0a6b65b61e56891cb38938919b1f98d8fad6/68747470733a2f2f64617669642d646d2e6f72672f6a6172656468616e736f6e2f70617373706f72742e737667\" alt=\"Dependencies\" data-canonical-src=\"https://david-dm.org/jaredhanson/passport.svg\" style=\"max-width: 100%;\"></a></p>\n<div class=\"markdown-heading\" dir=\"auto\"><h2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\">Install</h2><a id=\"user-content-install\" class=\"anchor\" aria-label=\"Permalink: Install\" href=\"#install\"><svg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"></path></svg></a></div>\n<div class=\"snippet-clipboard-content notranslate position-relative overflow-auto\" data-snippet-clipboard-copy-content=\"$ npm install passport\"><pre class=\"notranslate\"><code>$ npm install passport\n</code></pre></div>\n<div class=\"markdown-heading\" dir=\"auto\"><h2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\">Usage</h2><a id=\"user-content-usage\" class=\"anchor\" aria-label=\"Permalink: Usage\" href=\"#usage\"><svg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"></path></svg></a></div>\n<div class=\"markdown-heading\" dir=\"auto\"><h4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\">Strategies</h4><a id=\"user-content-strategies\" class=\"anchor\" aria-label=\"Permalink: Strategies\" href=\"#strategies\"><svg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"></path></svg></a></div>\n<p dir=\"auto\">Passport uses the concept of strategies to authenticate requests. Strategies\ncan range from verifying username and password credentials, delegated\nauthentication using <a href=\"http://oauth.net/\" rel=\"nofollow\">OAuth</a> (for example, via <a href=\"http://www.facebook.com/\" rel=\"nofollow\">Facebook</a>\nor <a href=\"http://twitter.com/\" rel=\"nofollow\">Twitter</a>), or federated authentication using <a href=\"http://openid.net/\" rel=\"nofollow\">OpenID</a>.</p>\n<p dir=\"auto\">Before authenticating requests, the strategy (or strategies) used by an\napplication must be configured.</p>\n<div class=\"highlight highlight-source-js notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"passport.use(new LocalStrategy(\n function(username, password, done) {\n User.findOne({ username: username }, function (err, user) {\n if (err) { return done(err); }\n if (!user) { return done(null, false); }\n if (!user.verifyPassword(password)) { return done(null, false); }\n return done(null, user);\n });\n }\n));\"><pre><span class=\"pl-s1\">passport</span><span class=\"pl-kos\">.</span><span class=\"pl-en\">use</span><span class=\"pl-kos\">(</span><span class=\"pl-k\">new</span> <span class=\"pl-v\">LocalStrategy</span><span class=\"pl-kos\">(</span>\n <span class=\"pl-k\">function</span><span class=\"pl-kos\">(</span><span class=\"pl-s1\">username</span><span class=\"pl-kos\">,</span> <span class=\"pl-s1\">password</span><span class=\"pl-kos\">,</span> <span class=\"pl-s1\">done</span><span class=\"pl-kos\">)</span> <span class=\"pl-kos\">{</span>\n <span class=\"pl-v\">User</span><span class=\"pl-kos\">.</span><span class=\"pl-en\">findOne</span><span class=\"pl-kos\">(</span><span class=\"pl-kos\">{</span> <span class=\"pl-c1\">username</span>: <span class=\"pl-s1\">username</span> <span class=\"pl-kos\">}</span><span class=\"pl-kos\">,</span> <span class=\"pl-k\">function</span> <span class=\"pl-kos\">(</span><span class=\"pl-s1\">err</span><span class=\"pl-kos\">,</span> <span class=\"pl-s1\">user</span><span class=\"pl-kos\">)</span> <span class=\"pl-kos\">{</span>\n <span class=\"pl-k\">if</span> <span class=\"pl-kos\">(</span><span class=\"pl-s1\">err</span><span class=\"pl-kos\">)</span> <span class=\"pl-kos\">{</span> <span class=\"pl-k\">return</span> <span class=\"pl-s1\">done</span><span class=\"pl-kos\">(</span><span class=\"pl-s1\">err</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">;</span> <span class=\"pl-kos\">}</span>\n <span class=\"pl-k\">if</span> <span class=\"pl-kos\">(</span><span class=\"pl-c1\">!</span><span class=\"pl-s1\">user</span><span class=\"pl-kos\">)</span> <span class=\"pl-kos\">{</span> <span class=\"pl-k\">return</span> <span class=\"pl-s1\">done</span><span class=\"pl-kos\">(</span><span class=\"pl-c1\">null</span><span class=\"pl-kos\">,</span> <span class=\"pl-c1\">false</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">;</span> <span class=\"pl-kos\">}</span>\n <span class=\"pl-k\">if</span> <span class=\"pl-kos\">(</span><span class=\"pl-c1\">!</span><span class=\"pl-s1\">user</span><span class=\"pl-kos\">.</span><span class=\"pl-en\">verifyPassword</span><span class=\"pl-kos\">(</span><span class=\"pl-s1\">password</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">)</span> <span class=\"pl-kos\">{</span> <span class=\"pl-k\">return</span> <span class=\"pl-s1\">done</span><span class=\"pl-kos\">(</span><span class=\"pl-c1\">null</span><span class=\"pl-kos\">,</span> <span class=\"pl-c1\">false</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">;</span> <span class=\"pl-kos\">}</span>\n <span class=\"pl-k\">return</span> <span class=\"pl-s1\">done</span><span class=\"pl-kos\">(</span><span class=\"pl-c1\">null</span><span class=\"pl-kos\">,</span> <span class=\"pl-s1\">user</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">;</span>\n <span class=\"pl-kos\">}</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">;</span>\n <span class=\"pl-kos\">}</span>\n<span class=\"pl-kos\">)</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">;</span></pre></div>\n<p dir=\"auto\">There are 480+ strategies. Find the ones you want at: <a href=\"http://passportjs.org\" rel=\"nofollow\">passportjs.org</a></p>\n<div class=\"markdown-heading\" dir=\"auto\"><h4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\">Sessions</h4><a id=\"user-content-sessions\" class=\"anchor\" aria-label=\"Permalink: Sessions\" href=\"#sessions\"><svg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"></path></svg></a></div>\n<p dir=\"auto\">Passport will maintain persistent login sessions. In order for persistent\nsessions to work, the authenticated user must be serialized to the session, and\ndeserialized when subsequent requests are made.</p>\n<p dir=\"auto\">Passport does not impose any restrictions on how your user records are stored.\nInstead, you provide functions to Passport which implements the necessary\nserialization and deserialization logic. In a typical application, this will be\nas simple as serializing the user ID, and finding the user by ID when\ndeserializing.</p>\n<div class=\"highlight highlight-source-js notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"passport.serializeUser(function(user, done) {\n done(null, user.id);\n});\n\npassport.deserializeUser(function(id, done) {\n User.findById(id, function (err, user) {\n done(err, user);\n });\n});\"><pre><span class=\"pl-s1\">passport</span><span class=\"pl-kos\">.</span><span class=\"pl-en\">serializeUser</span><span class=\"pl-kos\">(</span><span class=\"pl-k\">function</span><span class=\"pl-kos\">(</span><span class=\"pl-s1\">user</span><span class=\"pl-kos\">,</span> <span class=\"pl-s1\">done</span><span class=\"pl-kos\">)</span> <span class=\"pl-kos\">{</span>\n <span class=\"pl-s1\">done</span><span class=\"pl-kos\">(</span><span class=\"pl-c1\">null</span><span class=\"pl-kos\">,</span> <span class=\"pl-s1\">user</span><span class=\"pl-kos\">.</span><span class=\"pl-c1\">id</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">;</span>\n<span class=\"pl-kos\">}</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">;</span>\n\n<span class=\"pl-s1\">passport</span><span class=\"pl-kos\">.</span><span class=\"pl-en\">deserializeUser</span><span class=\"pl-kos\">(</span><span class=\"pl-k\">function</span><span class=\"pl-kos\">(</span><span class=\"pl-s1\">id</span><span class=\"pl-kos\">,</span> <span class=\"pl-s1\">done</span><span class=\"pl-kos\">)</span> <span class=\"pl-kos\">{</span>\n <span class=\"pl-v\">User</span><span class=\"pl-kos\">.</span><span class=\"pl-en\">findById</span><span class=\"pl-kos\">(</span><span class=\"pl-s1\">id</span><span class=\"pl-kos\">,</span> <span class=\"pl-k\">function</span> <span class=\"pl-kos\">(</span><span class=\"pl-s1\">err</span><span class=\"pl-kos\">,</span> <span class=\"pl-s1\">user</span><span class=\"pl-kos\">)</span> <span class=\"pl-kos\">{</span>\n <span class=\"pl-s1\">done</span><span class=\"pl-kos\">(</span><span class=\"pl-s1\">err</span><span class=\"pl-kos\">,</span> <span class=\"pl-s1\">user</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">;</span>\n <span class=\"pl-kos\">}</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">;</span>\n<span class=\"pl-kos\">}</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">;</span></pre></div>\n<div class=\"markdown-heading\" dir=\"auto\"><h4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\">Middleware</h4><a id=\"user-content-middleware\" class=\"anchor\" aria-label=\"Permalink: Middleware\" href=\"#middleware\"><svg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"></path></svg></a></div>\n<p dir=\"auto\">To use Passport in an <a href=\"http://expressjs.com/\" rel=\"nofollow\">Express</a> or\n<a href=\"http://senchalabs.github.com/connect/\">Connect</a>-based application, configure it\nwith the required <code>passport.initialize()</code> middleware. If your application uses\npersistent login sessions (recommended, but not required), <code>passport.session()</code>\nmiddleware must also be used.</p>\n<div class=\"highlight highlight-source-js notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"var app = express();\napp.use(require('serve-static')(__dirname + '/../../public'));\napp.use(require('cookie-parser')());\napp.use(require('body-parser').urlencoded({ extended: true }));\napp.use(require('express-session')({ secret: 'keyboard cat', resave: true, saveUninitialized: true }));\napp.use(passport.initialize());\napp.use(passport.session());\"><pre><span class=\"pl-k\">var</span> <span class=\"pl-s1\">app</span> <span class=\"pl-c1\">=</span> <span class=\"pl-en\">express</span><span class=\"pl-kos\">(</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">;</span>\n<span class=\"pl-s1\">app</span><span class=\"pl-kos\">.</span><span class=\"pl-en\">use</span><span class=\"pl-kos\">(</span><span class=\"pl-en\">require</span><span class=\"pl-kos\">(</span><span class=\"pl-s\">'serve-static'</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">(</span><span class=\"pl-s1\">__dirname</span> <span class=\"pl-c1\">+</span> <span class=\"pl-s\">'/../../public'</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">;</span>\n<span class=\"pl-s1\">app</span><span class=\"pl-kos\">.</span><span class=\"pl-en\">use</span><span class=\"pl-kos\">(</span><span class=\"pl-en\">require</span><span class=\"pl-kos\">(</span><span class=\"pl-s\">'cookie-parser'</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">(</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">;</span>\n<span class=\"pl-s1\">app</span><span class=\"pl-kos\">.</span><span class=\"pl-en\">use</span><span class=\"pl-kos\">(</span><span class=\"pl-en\">require</span><span class=\"pl-kos\">(</span><span class=\"pl-s\">'body-parser'</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">.</span><span class=\"pl-en\">urlencoded</span><span class=\"pl-kos\">(</span><span class=\"pl-kos\">{</span> <span class=\"pl-c1\">extended</span>: <span class=\"pl-c1\">true</span> <span class=\"pl-kos\">}</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">;</span>\n<span class=\"pl-s1\">app</span><span class=\"pl-kos\">.</span><span class=\"pl-en\">use</span><span class=\"pl-kos\">(</span><span class=\"pl-en\">require</span><span class=\"pl-kos\">(</span><span class=\"pl-s\">'express-session'</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">(</span><span class=\"pl-kos\">{</span> <span class=\"pl-c1\">secret</span>: <span class=\"pl-s\">'keyboard cat'</span><span class=\"pl-kos\">,</span> <span class=\"pl-c1\">resave</span>: <span class=\"pl-c1\">true</span><span class=\"pl-kos\">,</span> <span class=\"pl-c1\">saveUninitialized</span>: <span class=\"pl-c1\">true</span> <span class=\"pl-kos\">}</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">;</span>\n<span class=\"pl-s1\">app</span><span class=\"pl-kos\">.</span><span class=\"pl-en\">use</span><span class=\"pl-kos\">(</span><span class=\"pl-s1\">passport</span><span class=\"pl-kos\">.</span><span class=\"pl-en\">initialize</span><span class=\"pl-kos\">(</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">;</span>\n<span class=\"pl-s1\">app</span><span class=\"pl-kos\">.</span><span class=\"pl-en\">use</span><span class=\"pl-kos\">(</span><span class=\"pl-s1\">passport</span><span class=\"pl-kos\">.</span><span class=\"pl-en\">session</span><span class=\"pl-kos\">(</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">;</span></pre></div>\n<div class=\"markdown-heading\" dir=\"auto\"><h4 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\">Authenticate Requests</h4><a id=\"user-content-authenticate-requests\" class=\"anchor\" aria-label=\"Permalink: Authenticate Requests\" href=\"#authenticate-requests\"><svg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"></path></svg></a></div>\n<p dir=\"auto\">Passport provides an <code>authenticate()</code> function, which is used as route\nmiddleware to authenticate requests.</p>\n<div class=\"highlight highlight-source-js notranslate position-relative overflow-auto\" dir=\"auto\" data-snippet-clipboard-copy-content=\"app.post('/login', \n passport.authenticate('local', { failureRedirect: '/login' }),\n function(req, res) {\n res.redirect('/');\n });\"><pre><span class=\"pl-s1\">app</span><span class=\"pl-kos\">.</span><span class=\"pl-en\">post</span><span class=\"pl-kos\">(</span><span class=\"pl-s\">'/login'</span><span class=\"pl-kos\">,</span> \n <span class=\"pl-s1\">passport</span><span class=\"pl-kos\">.</span><span class=\"pl-en\">authenticate</span><span class=\"pl-kos\">(</span><span class=\"pl-s\">'local'</span><span class=\"pl-kos\">,</span> <span class=\"pl-kos\">{</span> <span class=\"pl-c1\">failureRedirect</span>: <span class=\"pl-s\">'/login'</span> <span class=\"pl-kos\">}</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">,</span>\n <span class=\"pl-k\">function</span><span class=\"pl-kos\">(</span><span class=\"pl-s1\">req</span><span class=\"pl-kos\">,</span> <span class=\"pl-s1\">res</span><span class=\"pl-kos\">)</span> <span class=\"pl-kos\">{</span>\n <span class=\"pl-s1\">res</span><span class=\"pl-kos\">.</span><span class=\"pl-en\">redirect</span><span class=\"pl-kos\">(</span><span class=\"pl-s\">'/'</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">;</span>\n <span class=\"pl-kos\">}</span><span class=\"pl-kos\">)</span><span class=\"pl-kos\">;</span></pre></div>\n<div class=\"markdown-heading\" dir=\"auto\"><h2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\">Strategies</h2><a id=\"user-content-strategies-1\" class=\"anchor\" aria-label=\"Permalink: Strategies\" href=\"#strategies-1\"><svg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"></path></svg></a></div>\n<p dir=\"auto\">Passport has a comprehensive set of <strong>over 480</strong> authentication strategies\ncovering social networking, enterprise integration, API services, and more.</p>\n<div class=\"markdown-heading\" dir=\"auto\"><h2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\">Search all strategies</h2><a id=\"user-content-search-all-strategies\" class=\"anchor\" aria-label=\"Permalink: Search all strategies\" href=\"#search-all-strategies\"><svg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"></path></svg></a></div>\n<p dir=\"auto\">There is a <strong>Strategy Search</strong> at <a href=\"http://passportjs.org\" rel=\"nofollow\">passportjs.org</a></p>\n<p dir=\"auto\">The following table lists commonly used strategies:</p>\n<table>\n<thead>\n<tr>\n<th>Strategy</th>\n<th>Protocol</th>\n<th>Developer</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td><a href=\"https://github.com/jaredhanson/passport-local\">Local</a></td>\n<td>HTML form</td>\n<td><a href=\"https://github.com/jaredhanson\">Jared Hanson</a></td>\n</tr>\n<tr>\n<td><a href=\"https://github.com/jaredhanson/passport-openid\">OpenID</a></td>\n<td>OpenID</td>\n<td><a href=\"https://github.com/jaredhanson\">Jared Hanson</a></td>\n</tr>\n<tr>\n<td><a href=\"https://github.com/jaredhanson/passport-browserid\">BrowserID</a></td>\n<td>BrowserID</td>\n<td><a href=\"https://github.com/jaredhanson\">Jared Hanson</a></td>\n</tr>\n<tr>\n<td><a href=\"https://github.com/jaredhanson/passport-facebook\">Facebook</a></td>\n<td>OAuth 2.0</td>\n<td><a href=\"https://github.com/jaredhanson\">Jared Hanson</a></td>\n</tr>\n<tr>\n<td><a href=\"https://github.com/jaredhanson/passport-google\">Google</a></td>\n<td>OpenID</td>\n<td><a href=\"https://github.com/jaredhanson\">Jared Hanson</a></td>\n</tr>\n<tr>\n<td><a href=\"https://github.com/jaredhanson/passport-google-oauth\">Google</a></td>\n<td>OAuth / OAuth 2.0</td>\n<td><a href=\"https://github.com/jaredhanson\">Jared Hanson</a></td>\n</tr>\n<tr>\n<td><a href=\"https://github.com/jaredhanson/passport-twitter\">Twitter</a></td>\n<td>OAuth</td>\n<td><a href=\"https://github.com/jaredhanson\">Jared Hanson</a></td>\n</tr>\n<tr>\n<td><a href=\"https://github.com/AzureAD/passport-azure-ad\">Azure Active Directory</a></td>\n<td>OAuth 2.0 / OpenID / SAML</td>\n<td><a href=\"https://github.com/azuread\">Azure</a></td>\n</tr>\n</tbody>\n</table>\n<div class=\"markdown-heading\" dir=\"auto\"><h2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\">Examples</h2><a id=\"user-content-examples\" class=\"anchor\" aria-label=\"Permalink: Examples\" href=\"#examples\"><svg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"></path></svg></a></div>\n<ul dir=\"auto\">\n<li>For a complete, working example, refer to the <a href=\"https://github.com/passport/express-4.x-local-example\">example</a>\nthat uses <a href=\"https://github.com/jaredhanson/passport-local\">passport-local</a>.</li>\n<li><strong>Local Strategy</strong>: Refer to the following tutorials for setting up user authentication via LocalStrategy (<code>passport-local</code>):\n<ul dir=\"auto\">\n<li>Mongo\n<ul dir=\"auto\">\n<li>Express v3x - <a href=\"http://mherman.org/blog/2016/09/25/node-passport-and-postgres/#.V-govpMrJE5\" rel=\"nofollow\">Tutorial</a> / <a href=\"https://github.com/mjhea0/passport-local-knex\">working example</a></li>\n<li>Express v4x - <a href=\"http://mherman.org/blog/2015/01/31/local-authentication-with-passport-and-express-4/\" rel=\"nofollow\">Tutorial</a> / <a href=\"https://github.com/mjhea0/passport-local-express4\">working example</a></li>\n</ul>\n</li>\n<li>Postgres\n<ul dir=\"auto\">\n<li><a href=\"http://mherman.org/blog/2015/01/31/local-authentication-with-passport-and-express-4/\" rel=\"nofollow\">Tutorial</a> / <a href=\"https://github.com/mjhea0/passport-local-express4\">working example</a></li>\n</ul>\n</li>\n</ul>\n</li>\n<li><strong>Social Authentication</strong>: Refer to the following tutorials for setting up various social authentication strategies:\n<ul dir=\"auto\">\n<li>Express v3x - <a href=\"http://mherman.org/blog/2013/11/10/social-authentication-with-passport-dot-js/\" rel=\"nofollow\">Tutorial</a> / <a href=\"https://github.com/mjhea0/passport-examples\">working example</a></li>\n<li>Express v4x - <a href=\"http://mherman.org/blog/2015/09/26/social-authentication-in-node-dot-js-with-passport\" rel=\"nofollow\">Tutorial</a> / <a href=\"https://github.com/mjhea0/passport-social-auth\">working example</a></li>\n</ul>\n</li>\n</ul>\n<div class=\"markdown-heading\" dir=\"auto\"><h2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\">Related Modules</h2><a id=\"user-content-related-modules\" class=\"anchor\" aria-label=\"Permalink: Related Modules\" href=\"#related-modules\"><svg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"></path></svg></a></div>\n<ul dir=\"auto\">\n<li><a href=\"https://github.com/jaredhanson/locomotive\">Locomotive</a> — Powerful MVC web framework</li>\n<li><a href=\"https://github.com/jaredhanson/oauthorize\">OAuthorize</a> — OAuth service provider toolkit</li>\n<li><a href=\"https://github.com/jaredhanson/oauth2orize\">OAuth2orize</a> — OAuth 2.0 authorization server toolkit</li>\n<li><a href=\"https://github.com/jaredhanson/connect-ensure-login\">connect-ensure-login</a> — middleware to ensure login sessions</li>\n</ul>\n<p dir=\"auto\">The <a href=\"https://github.com/jaredhanson/passport/wiki/Modules\">modules</a> page on the\n<a href=\"https://github.com/jaredhanson/passport/wiki\">wiki</a> lists other useful modules\nthat build upon or integrate with Passport.</p>\n<div class=\"markdown-heading\" dir=\"auto\"><h2 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\">License</h2><a id=\"user-content-license\" class=\"anchor\" aria-label=\"Permalink: License\" href=\"#license\"><svg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"></path></svg></a></div>\n<p dir=\"auto\"><a href=\"http://opensource.org/licenses/MIT\" rel=\"nofollow\">The MIT License</a></p>\n<p dir=\"auto\">Copyright (c) 2011-2021 Jared Hanson &lt;<a href=\"https://www.jaredhanson.me/\" rel=\"nofollow\">https://www.jaredhanson.me/</a>&gt;</p>\n</article>",
"loaded": true,
"timedOut": false,
"errorMessage": null,
"headerInfo": {
"toc": [
{
"level": 1,
"text": "Passport",
"anchor": "passport",
"htmlText": "Passport"
},
{
"level": 2,
"text": "Install",
"anchor": "install",
"htmlText": "Install"
},
{
"level": 2,
"text": "Usage",
"anchor": "usage",
"htmlText": "Usage"
},
{
"level": 4,
"text": "Strategies",
"anchor": "strategies",
"htmlText": "Strategies"
},
{
"level": 4,
"text": "Sessions",
"anchor": "sessions",
"htmlText": "Sessions"
},
{
"level": 4,
"text": "Middleware",
"anchor": "middleware",
"htmlText": "Middleware"
},
{
"level": 4,
"text": "Authenticate Requests",
"anchor": "authenticate-requests",
"htmlText": "Authenticate Requests"
},
{
"level": 2,
"text": "Strategies",
"anchor": "strategies-1",
"htmlText": "Strategies"
},
{
"level": 2,
"text": "Search all strategies",
"anchor": "search-all-strategies",
"htmlText": "Search all strategies"
},
{
"level": 2,
"text": "Examples",
"anchor": "examples",
"htmlText": "Examples"
},
{
"level": 2,
"text": "Related Modules",
"anchor": "related-modules",
"htmlText": "Related Modules"
},
{
"level": 2,
"text": "License",
"anchor": "license",
"htmlText": "License"
}
],
"siteNavLoginPath": "/login?return_to=https%3A%2F%2Fgithub.com%2Fjaredhanson%2Fpassport"
}
},
{
"displayName": "LICENSE",
"repoName": "passport",
"refName": "master",
"path": "LICENSE",
"preferredFileType": "license",
"tabName": "MIT",
"richText": null,
"loaded": false,
"timedOut": false,
"errorMessage": null,
"headerInfo": {
"toc": null,
"siteNavLoginPath": "/login?return_to=https%3A%2F%2Fgithub.com%2Fjaredhanson%2Fpassport"
}
}
],
"overviewFilesProcessingTime": 20.540947
}
},
"appPayload": {
"helpUrl": "https://docs.github.com",
"findFileWorkerPath": "/assets-cdn/worker/find-file-worker-a007d7f370d6.js",
"findInFileWorkerPath": "/assets-cdn/worker/find-in-file-worker-d0f0ff069004.js",
"githubDevUrl": null,
"enabled_features": {
"code_nav_ui_events": false,
"copilot_conversational_ux": false,
"react_blob_overlay": false,
"copilot_conversational_ux_embedding_update": false,
"copilot_popover_file_editor_header": true,
"copilot_smell_icebreaker_ux": true,
"copilot_workspace": false
}
}
}
}
{
"accept-ranges": "bytes",
"cache-control": "max-age=0, private, must-revalidate",
"content-encoding": "gzip",
"content-security-policy": "default-src 'none'; base-uri 'self'; child-src github.com/assets-cdn/worker/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com api.githubcopilot.com objects-origin.githubusercontent.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.com/assets-cdn/worker/ gist.github.com/assets-cdn/worker/",
"content-type": "text/html; charset=utf-8",
"date": "Mon, 22 Apr 2024 08:54:53 GMT",
"etag": "f80f1772b3b738a0f8022a12eec4de2e",
"referrer-policy": "no-referrer-when-downgrade",
"server": "GitHub.com",
"set-cookie": "logged_in=no; Path=/; Domain=github.com; Expires=Tue, 22 Apr 2025 08:54:53 GMT; HttpOnly; Secure; SameSite=Lax",
"strict-transport-security": "max-age=31536000; includeSubdomains; preload",
"transfer-encoding": "chunked",
"vary": "X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, Accept-Encoding, Accept, X-Requested-With",
"x-content-type-options": "nosniff",
"x-frame-options": "deny",
"x-github-request-id": "98F8:29F3CD:3995ADC:51D7E07:662625DD",
"x-xss-protection": "0"
}