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.
name | type | description | optional |
---|
auth | Auth | Lucia instance | |
config.clientId | string | Patreon OAuth app client id | |
config.clientSecret | string | Patreon OAuth app client secret | |
config.redirectUri | string | one of the authorized redirect URIs | |
config.scope | string[] | an array of scopes | ✓ |
Returns#
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#
name | extends | default |
---|
_Auth | Auth | Auth |
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;
}
Generics#