[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-3020":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":18,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":33,"readmeContent":34,"aiSummary":35,"trendingCount":16,"starSnapshotCount":16,"syncStatus":36,"lastSyncTime":37,"discoverSource":38},3020,"passport","jaredhanson\u002Fpassport","jaredhanson","Simple, unobtrusive authentication for Node.js.","https:\u002F\u002Fwww.passportjs.org?utm_source=github&utm_medium=referral&utm_campaign=passport&utm_content=about",null,"JavaScript",23533,1250,291,355,0,1,3,10,44.29,"MIT License",false,"master",true,[26,27,28,29,30,31,5,32],"express","nodejs","oauth","oauth2","openid","openid-connect","saml","2026-06-12 02:00:45","[![passport banner](http:\u002F\u002Fcdn.auth0.com\u002Fimg\u002Fpassport-banner-github.png)](http:\u002F\u002Fpassportjs.org)\n\n# Passport\n\nPassport is [Express](http:\u002F\u002Fexpressjs.com\u002F)-compatible authentication\nmiddleware for [Node.js](http:\u002F\u002Fnodejs.org\u002F).\n\nPassport's sole purpose is to authenticate requests, which it does through an\nextensible set of plugins known as _strategies_.  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.\n\n---\n\n\u003Cdiv align=\"center\">\n  \u003Csup>Sponsors\u003C\u002Fsup>\n  \u003Cbr>\n  \u003C!-- Auth0 -->\n  \u003Cdiv>\n    \u003Ca href=\"https:\u002F\u002Fauth0.com\u002F\">\n      \u003Cpicture>\n        \u003Csource srcset=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fjaredhanson\u002Fpassport\u002Fmaster\u002Fsponsors\u002Fauth0.png\" media=\"(prefers-color-scheme: light)\">\n        \u003Csource srcset=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fjaredhanson\u002Fpassport\u002Fmaster\u002Fsponsors\u002Fauth0-dark.png\" media=\"(prefers-color-scheme: dark)\">\n        \u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fjaredhanson\u002Fpassport\u002Fmaster\u002Fsponsors\u002Fauth0.svg\" width=\"275\">\n      \u003C\u002Fpicture>\n      \u003Cp>\n        \u003Cb>Simple Authentication\u003C\u002Fb>\n        \u003Cbr>\n        Make login our problem. Not yours.\n      \u003C\u002Fp>\n    \u003C\u002Fa>\n    \u003Cp>Auth0 by Okta provides a simple and customizable login page to authenticate your users. You can dynamically add new capabilities to it - including social login, multi-factor authentication, or passkeys - without making changes to your app’s code.\u003C\u002Fp>\n    \u003Cp>We help protect your app and your users from attacks - defending your application from bot attacks and detecting runtime anomalies based on suspicious IPs, breached credentials, user context, and more.\u003C\u002Fp>\n  \u003C\u002Fdiv>\n  \u003Cbr>\n  \u003C!-- WorkOS -->\n  \u003Cdiv>\n    \u003Ca href=\"https:\u002F\u002Fworkos.com\u002F?utm_campaign=github_repo&utm_medium=referral&utm_content=passport_js&utm_source=github\">\n      \u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fjaredhanson\u002Fpassport\u002Fmaster\u002Fsponsors\u002Fworkos.png\">\n      \u003Cp>\n        \u003Cb>Your app, enterprise-ready.\u003C\u002Fb>\n        \u003Cbr>\n        Start selling to enterprise customers with just a few lines of code. Add Single Sign-On (and more) in minutes instead of months.\n      \u003C\u002Fp>\n    \u003C\u002Fa>\n  \u003C\u002Fdiv>\n  \u003Cbr>\n  \u003C!-- Descope -->\n  \u003Cdiv>\n    \u003Ca href=\"https:\u002F\u002Fwww.descope.com\u002F?utm_source=PassportJS&utm_medium=referral&utm_campaign=oss-sponsorship\">\n      \u003Cpicture>\n        \u003Csource srcset=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fjaredhanson\u002Fpassport\u002Fmaster\u002Fsponsors\u002Fdescope.svg\" media=\"(prefers-color-scheme: light)\">\n        \u003Csource srcset=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fjaredhanson\u002Fpassport\u002Fmaster\u002Fsponsors\u002Fdescope-dark.svg\" media=\"(prefers-color-scheme: dark)\">\n        \u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fjaredhanson\u002Fpassport\u002Fmaster\u002Fsponsors\u002Fdescope.svg\" width=\"275\">\n      \u003C\u002Fpicture>\n      \u003Cp>\n        \u003Cb>Drag and drop your auth\u003C\u002Fb>\n        \u003Cbr>\n        Add authentication and user management to your consumer and business apps with a few lines of code.\n      \u003C\u002Fp>\n    \u003C\u002Fa>\n  \u003C\u002Fdiv>\n  \u003Cbr>\n  \u003C!-- FusionAuth -->\n  \u003Cdiv>\n    \u003Ca href=\"https:\u002F\u002Ffusionauth.io\u002F?utm_source=passportjs&utm_medium=referral&utm_campaign=sponsorship\">\n      \u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fjaredhanson\u002Fpassport\u002Fmaster\u002Fsponsors\u002Ffusionauth.png\" width=\"275\">\n      \u003Cp>\n        \u003Cb>Auth. Built for Devs, by Devs\u003C\u002Fb>\n        \u003Cbr>\n        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.\n      \u003C\u002Fp>\n    \u003C\u002Fa>\n  \u003C\u002Fdiv>\n  \u003Cbr>\n  \u003C!-- Stytch -->\n  \u003Cdiv>\n    \u003Ca href=\"https:\u002F\u002Fstytch.com?utm_source=oss-sponsorship&utm_medium=paid_sponsorship&utm_campaign=passportjs\">\n      \u003Cpicture>\n        \u003Csource srcset=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fjaredhanson\u002Fpassport\u002Fmaster\u002Fsponsors\u002Fstytch.png\" media=\"(prefers-color-scheme: light)\">\n        \u003Csource srcset=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fjaredhanson\u002Fpassport\u002Fmaster\u002Fsponsors\u002Fstytch-dark.png\" media=\"(prefers-color-scheme: dark)\">\n        \u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fjaredhanson\u002Fpassport\u002Fmaster\u002Fsponsors\u002Fstytch.png\" width=\"275\">\n      \u003C\u002Fpicture>\n      \u003Cp>\n        \u003Cb>API-first AuthN, AuthZ, and Fraud Prevention\u003C\u002Fb>\n        \u003Cbr>\n        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.\n      \u003C\u002Fp>\n    \u003C\u002Fa>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\n\n---\n\nStatus:\n[![Build](https:\u002F\u002Ftravis-ci.org\u002Fjaredhanson\u002Fpassport.svg?branch=master)](https:\u002F\u002Ftravis-ci.org\u002Fjaredhanson\u002Fpassport)\n[![Coverage](https:\u002F\u002Fcoveralls.io\u002Frepos\u002Fjaredhanson\u002Fpassport\u002Fbadge.svg?branch=master)](https:\u002F\u002Fcoveralls.io\u002Fr\u002Fjaredhanson\u002Fpassport)\n[![Dependencies](https:\u002F\u002Fdavid-dm.org\u002Fjaredhanson\u002Fpassport.svg)](https:\u002F\u002Fdavid-dm.org\u002Fjaredhanson\u002Fpassport)\n\n\n## Install\n\n```\n$ npm install passport\n```\n\n## Usage\n\n#### Strategies\n\nPassport uses the concept of strategies to authenticate requests.  Strategies\ncan range from verifying username and password credentials, delegated\nauthentication using [OAuth](http:\u002F\u002Foauth.net\u002F) (for example, via [Facebook](http:\u002F\u002Fwww.facebook.com\u002F)\nor [Twitter](http:\u002F\u002Ftwitter.com\u002F)), or federated authentication using [OpenID](http:\u002F\u002Fopenid.net\u002F).\n\nBefore authenticating requests, the strategy (or strategies) used by an\napplication must be configured.\n\n```javascript\npassport.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));\n```\n\nThere are 480+ strategies. Find the ones you want at: [passportjs.org](http:\u002F\u002Fpassportjs.org)\n\n#### Sessions\n\nPassport 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.\n\nPassport 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.\n\n```javascript\npassport.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});\n```\n\n#### Middleware\n\nTo use Passport in an [Express](http:\u002F\u002Fexpressjs.com\u002F) or\n[Connect](http:\u002F\u002Fsenchalabs.github.com\u002Fconnect\u002F)-based application, configure it\nwith the required `passport.initialize()` middleware.  If your application uses\npersistent login sessions (recommended, but not required), `passport.session()`\nmiddleware must also be used.\n\n```javascript\nvar app = express();\napp.use(require('serve-static')(__dirname + '\u002F..\u002F..\u002Fpublic'));\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());\n```\n\n#### Authenticate Requests\n\nPassport provides an `authenticate()` function, which is used as route\nmiddleware to authenticate requests.\n\n```javascript\napp.post('\u002Flogin', \n  passport.authenticate('local', { failureRedirect: '\u002Flogin' }),\n  function(req, res) {\n    res.redirect('\u002F');\n  });\n```\n\n## Strategies\n\nPassport has a comprehensive set of **over 480** authentication strategies\ncovering social networking, enterprise integration, API services, and more.\n\n## Search all strategies\n\nThere is a **Strategy Search** at [passportjs.org](http:\u002F\u002Fpassportjs.org)\n\nThe following table lists commonly used strategies:\n\n|Strategy                                                       | Protocol                 |Developer                                       |\n|---------------------------------------------------------------|--------------------------|------------------------------------------------|\n|[Local](https:\u002F\u002Fgithub.com\u002Fjaredhanson\u002Fpassport-local)         | HTML form                |[Jared Hanson](https:\u002F\u002Fgithub.com\u002Fjaredhanson)  |\n|[OpenID](https:\u002F\u002Fgithub.com\u002Fjaredhanson\u002Fpassport-openid)       | OpenID                   |[Jared Hanson](https:\u002F\u002Fgithub.com\u002Fjaredhanson)  |\n|[BrowserID](https:\u002F\u002Fgithub.com\u002Fjaredhanson\u002Fpassport-browserid) | BrowserID                |[Jared Hanson](https:\u002F\u002Fgithub.com\u002Fjaredhanson)  |\n|[Facebook](https:\u002F\u002Fgithub.com\u002Fjaredhanson\u002Fpassport-facebook)   | OAuth 2.0                |[Jared Hanson](https:\u002F\u002Fgithub.com\u002Fjaredhanson)  |\n|[Google](https:\u002F\u002Fgithub.com\u002Fjaredhanson\u002Fpassport-google)       | OpenID                   |[Jared Hanson](https:\u002F\u002Fgithub.com\u002Fjaredhanson)  |\n|[Google](https:\u002F\u002Fgithub.com\u002Fjaredhanson\u002Fpassport-google-oauth) | OAuth \u002F OAuth 2.0        |[Jared Hanson](https:\u002F\u002Fgithub.com\u002Fjaredhanson)  |\n|[Twitter](https:\u002F\u002Fgithub.com\u002Fjaredhanson\u002Fpassport-twitter)     | OAuth                    |[Jared Hanson](https:\u002F\u002Fgithub.com\u002Fjaredhanson)  |\n|[Azure Active Directory](https:\u002F\u002Fgithub.com\u002FAzureAD\u002Fpassport-azure-ad)     | OAuth 2.0 \u002F OpenID \u002F SAML  |[Azure](https:\u002F\u002Fgithub.com\u002Fazuread)  |\n\n## Examples\n\n- For a complete, working example, refer to the [example](https:\u002F\u002Fgithub.com\u002Fpassport\u002Fexpress-4.x-local-example)\nthat uses [passport-local](https:\u002F\u002Fgithub.com\u002Fjaredhanson\u002Fpassport-local).\n- **Local Strategy**: Refer to the following tutorials for setting up user authentication via LocalStrategy (`passport-local`):\n    - Mongo\n      - Express v3x - [Tutorial](http:\u002F\u002Fmherman.org\u002Fblog\u002F2016\u002F09\u002F25\u002Fnode-passport-and-postgres\u002F#.V-govpMrJE5) \u002F [working example](https:\u002F\u002Fgithub.com\u002Fmjhea0\u002Fpassport-local-knex)\n      - Express v4x - [Tutorial](http:\u002F\u002Fmherman.org\u002Fblog\u002F2015\u002F01\u002F31\u002Flocal-authentication-with-passport-and-express-4\u002F) \u002F [working example](https:\u002F\u002Fgithub.com\u002Fmjhea0\u002Fpassport-local-express4)\n    - Postgres\n      - [Tutorial](http:\u002F\u002Fmherman.org\u002Fblog\u002F2015\u002F01\u002F31\u002Flocal-authentication-with-passport-and-express-4\u002F) \u002F [working example](https:\u002F\u002Fgithub.com\u002Fmjhea0\u002Fpassport-local-express4)\n- **Social Authentication**: Refer to the following tutorials for setting up various social authentication strategies:\n    - Express v3x - [Tutorial](http:\u002F\u002Fmherman.org\u002Fblog\u002F2013\u002F11\u002F10\u002Fsocial-authentication-with-passport-dot-js\u002F) \u002F [working example](https:\u002F\u002Fgithub.com\u002Fmjhea0\u002Fpassport-examples)\n    - Express v4x - [Tutorial](http:\u002F\u002Fmherman.org\u002Fblog\u002F2015\u002F09\u002F26\u002Fsocial-authentication-in-node-dot-js-with-passport) \u002F [working example](https:\u002F\u002Fgithub.com\u002Fmjhea0\u002Fpassport-social-auth)\n\n## Related Modules\n\n- [Locomotive](https:\u002F\u002Fgithub.com\u002Fjaredhanson\u002Flocomotive) — Powerful MVC web framework\n- [OAuthorize](https:\u002F\u002Fgithub.com\u002Fjaredhanson\u002Foauthorize) — OAuth service provider toolkit\n- [OAuth2orize](https:\u002F\u002Fgithub.com\u002Fjaredhanson\u002Foauth2orize) — OAuth 2.0 authorization server toolkit\n- [connect-ensure-login](https:\u002F\u002Fgithub.com\u002Fjaredhanson\u002Fconnect-ensure-login)  — middleware to ensure login sessions\n\nThe [modules](https:\u002F\u002Fgithub.com\u002Fjaredhanson\u002Fpassport\u002Fwiki\u002FModules) page on the\n[wiki](https:\u002F\u002Fgithub.com\u002Fjaredhanson\u002Fpassport\u002Fwiki) lists other useful modules\nthat build upon or integrate with Passport.\n\n## License\n\n[The MIT License](http:\u002F\u002Fopensource.org\u002Flicenses\u002FMIT)\n\nCopyright (c) 2011-2021 Jared Hanson \u003C[https:\u002F\u002Fwww.jaredhanson.me\u002F](https:\u002F\u002Fwww.jaredhanson.me\u002F)>\n","Passport 是一个为 Node.js 设计的简单且不显眼的身份验证中间件，兼容 Express 框架。其核心功能是通过一系列可扩展的插件（称为策略）来认证请求，支持 OAuth、OAuth2、OpenID、SAML 等多种认证协议，同时不强制使用特定的数据库模式或路由配置，极大提高了灵活性和开发者自定义能力。适用于需要实现用户登录、第三方服务集成等身份验证需求的各种 Web 应用场景，尤其是基于 Node.js 和 Express 构建的应用程序。",2,"2026-06-11 02:52:12","top_language"]