Patreon OAuth provider

OAuth integration for Patreon. Refer to Patreon OAuth documentation for getting the required credentials. Provider id is patreon.

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

const patreonAuth = patreon(auth, configs);

The identity scope is always included regardless of provided scope config.

patreon()#

const patreon: (
	auth: Auth,
	configs: {
		clientId: string;
		clientSecret: string;
		redirectUri: string;
		scope?: string[];
	}
) => PatreonProvider;
Parameters#

Scope identity is always included.

nametypedescriptionoptional
authAuthLucia instance
config.clientIdstringPatreon OAuth app client id
config.clientSecretstringPatreon OAuth app client secret
config.redirectUristringone of the authorized redirect URIs
config.scopestring[]an array of scopes
Returns#
typedescription
PatreonProviderPatreon provider

Interfaces#

PatreonAuth#

See OAuth2ProviderAuth.

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

PatreonTokens#

type PatreonTokens = {
	accessToken: string;
	refreshToken: string | null;
	accessTokenExpiresIn: number;
};

PatreonUser#

type PatreonUser = {
	id: string;
	attributes: {
		about: string | null;
		created: string;
		email?: string;
		full_name: string;
		hide_pledges: boolean | null;
		image_url: string;
		is_email_verified: boolean;
		url: string;
	};
};

PatreonUserAuth#

Extends ProviderUserAuth.

interface PatreonUserAuth<_Auth extends Auth> extends ProviderUserAuth<_Auth> {
	patreonUser: PatreonUser;
	patreonTokens: PatreonTokens;
}
propertiestypedescription
patreonUserPatreonUserPatreon user
patreonTokensPatreonTokensAccess tokens etc
Generics#
nameextends
_AuthAuth