Auth0 OAuth provider

OAuth integration for Auth0. Refer to Auth0 OAuth documentation for getting the required credentials. Provider id is auth0.

import { auth0 } from "@lucia-auth/oauth/providers";
import { auth } from "./lucia.js";

const auth0Auth = auth0(auth, config);

auth0()#

const auth0: (
	auth: Auth,
	config: {
		appDomain: string;
		clientId: string;
		clientSecret: string;
		redirectUri: string;
		scope?: string[];
	}
) => Auth0Provider;
Parameters#

Scopes openid and profile are always included

nametypedescriptionoptional
authAuthLucia instance
config.appDomainstringAuth0 OAuth app domain
config.clientIdstringAuth0 OAuth app client id
config.clientSecretstringAuth0 OAuth app client secret
config.redirectUristringAuth0 OAuth app redirect uri
config.scopestring[]an array of scopes
Returns#
typedescription
Auth0ProviderAuth0 provider

Interfaces#

Auth0Auth#

See OAuth2ProviderAuth.

// implements OAuth2ProviderAuth<Auth0Auth<_Auth>>
interface Auth0Auth<_Auth extends Auth> {
	getAuthorizationUrl: () => Promise<readonly [url: URL, state: string]>;
	validateCallback: (code: string) => Promise<Auth0UserAuth<_Auth>>;
}
Generics#
nameextendsdefault
_AuthAuthAuth

Auth0Tokens#

type Auth0Tokens = {
	accessToken: string;
	refreshToken: string;
	idToken: string;
	tokenType: string;
};

Auth0User#

type Auth0User = {
	id: string;
	sub: string;
	name: string;
	picture: string;
	locale: string;
	updated_at: string;
	given_name?: string;
	family_name?: string;
	middle_name?: string;
	nickname?: string;
	preferred_username?: string;
	profile?: string;
	email?: string;
	email_verified?: boolean;
	gender?: string;
	birthdate?: string;
	zoneinfo?: string;
	phone_number?: string;
	phone_number_verified?: boolean;
};

Auth0UserAuth#

Extends ProviderUserAuth.

interface Auth0UserAuth<_Auth extends Auth> extends ProviderUserAuth<_Auth> {
	auth0User: Auth0User;
	auth0Tokens: Auth0Tokens;
}
propertiestypedescription
auth0UserAuth0UserAuth0 user
auth0TokensAuth0TokensAccess tokens etc
Generics#
nameextends
_AuthAuth