DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/passport-auth0 package

1.4.3 • Public • Published


ℹ️ Maintenance Advisory: With the release of, we will no longer be adding new features to this library, however we will continue to maintain this library and fix issues. You can read more about the release of our new library at

This is the Auth0 authentication strategy for Passport.js. Passport is authentication middleware for Node.js that can be unobtrusively dropped into any Express-based web application.

For Management API endpoints, please see the Node Auth0 SDK.

Build Status npm npm License FOSSA Status

Table of Contents


Full documentation with examples can be found in the Node.js Quickstart.

You can also see fully working demos using this library in our Auth0 blog:


The Auth0 Passport strategy is installed with npm.

npm install passport-auth0


State parameter

The Auth0 Passport strategy enforces the use of the state parameter in OAuth 2.0 authorization requests and requires session support in Express to be enabled.

If you require the state parameter to be omitted (which is not recommended), you can suppress it when calling the Auth0 Passport strategy constructor:

const Auth0Strategy = require('passport-auth0');
const strategy = new Auth0Strategy({
     // ...
     state: false
  function(accessToken, refreshToken, extraParams, profile, done) {
    // ...

More on state handling here.


If you want to change the scope of the ID token provided, add a scope property to the authenticate configuration passed when defining the route. These must be OIDC standard scopes. If you need data outside of the standard scopes, you can add custom claims to the token.

	passport.authenticate('auth0', {scope: 'openid email profile'}), 
	function (req, res) {

Force a Specific IdP

If you want to force a specific identity provider you can use:

	passport.authenticate('auth0', {connection: 'google-oauth2'}), 
	function (req, res) {

If you force an identity provider you can also request custom scope from that identity provider:

	passport.authenticate('auth0', {
		connection: 'google-oauth2',
		connection_scope: ','
	function (req, res) {

Getting Access Tokens

If you want to specify an audience for the returned access_token you can:

	passport.authenticate('auth0', {audience: 'urn:my-api'}), 
	function (req, res) {

Silent Authentication

If you want to check authentication without showing a prompt:

	passport.authenticate('auth0', {prompt: 'none'}), 
	function (req, res) {

Support + Feedback

  • Use Issues for code-level support
  • Use our Community for usage, questions, specific cases

Vulnerability Reporting

Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.

What is Auth0?

Auth0 helps you to easily:

  • implement authentication with multiple identity providers, including social (e.g., Google, Facebook, Microsoft, LinkedIn, GitHub, Twitter, etc), or enterprise (e.g., Windows Azure AD, Google Apps, Active Directory, ADFS, SAML, etc.)
  • log in users with username/password databases, passwordless, or multi-factor authentication
  • link multiple user accounts together
  • generate signed JSON Web Tokens to authorize your API calls and flow the user identity securely
  • access demographics and analytics detailing how, when, and where users are logging in
  • enrich user profiles from other data sources using customizable JavaScript rules

Why Auth0?


This project is licensed under the MIT license. See the LICENSE file for more info.

FOSSA Status




DownloadsWeekly Downloads






Unpacked Size

63 kB

Total Files


Last publish


  • ncluer
  • vic-dev
  • enriquepina
  • ece-okta
  • pubalokta
  • dougmiller-okta
  • zak.nour
  • stheller
  • jamescgarrett-okta
  • madhuri.rm23
  • willvedd
  • david.renaud.okta
  • jeff.shuman
  • auth0-oss
  • codepete
  • ziluvatar
  • iaco
  • cocojoe
  • auth0npm
  • auth0brokkr
  • hzalaz
  • aaguiarz
  • charlesrea
  • lbalmaceda
  • julien.wollscheid
  • cristiandouce
  • sambego
  • stevehobbsdev
  • sandrinodimattia
  • lzychowski
  • joshcanhelp
  • rob.coles
  • rosnovsky
  • davidpatrick0
  • widcket
  • adamjmcgrath
  • jim.andersoon
  • frederikprijck
  • sergii.biienko
  • tomauth0
  • jpadilla
  • jessele
  • rhamzeh_auth0
  • greglopez