Patreon social login
An application needs users to sign in with Patreon accounts.
Auth.js · Const
Patreon is a built-in Auth.js OAuth provider. Configure it with Patreon credentials and add the resulting provider configuration to Auth.js.
The Patreon provider is a built-in OAuth integration. Add it to Auth.js with a client ID and secret; Auth.js supplies Patreon’s default OAuth configuration and returns an OAuth provider configuration that can be used by the request handler.
function default<P extends PatreonProfile>(options): OAuthConfig<P>| Name | Type | Description |
|---|---|---|
options | OAuthUserConfig<P> | OAuth provider options, including the Patreon client ID and client secret. |
OAuthConfig<P>
/api/auth/callback/patreon path on the application’s origin.AUTH_PATREON_ID and AUTH_PATREON_SECRET as the environment variables for Patreon credentials.import { Auth } from "@auth/core"
import Patreon from "@auth/core/providers/patreon"
const request = new Request(origin)
const response = await Auth(request, {
providers: [
Patreon({
clientId: process.env.AUTH_PATREON_ID,
clientSecret: process.env.AUTH_PATREON_SECRET,
}),
],
})Create the Auth.js request handler with the Patreon provider and credentials supplied through environment variables.
An application needs users to sign in with Patreon accounts.
A Core-based Auth.js deployment needs a preconfigured Patreon OAuth integration.
The standard provider settings do not fit a deployment’s OAuth requirements.
Import the built-in provider and include its configured result in the Auth.js providers array. Pass the Patreon client ID and client secret through the provider options.
Follow-up: How can the defaults be changed? Use the documented customization approach for a built-in OAuth provider and override the provider configuration for the specific use case.
The provider callback URL is https://example.com/api/auth/callback/patreon. The Patreon application must be configured to redirect to the corresponding deployment URL.
Follow-up: What must change for another deployment? Replace example.com with the application’s actual origin while retaining the /api/auth/callback/patreon path.
The provider function accepts OAuthUserConfig<P> and returns OAuthConfig<P>, where P extends PatreonProfile. The profile type exposes string fields including email, nickname, picture, and sub.
Follow-up: What is the purpose of the generic profile type? It allows the provider configuration and returned OAuth configuration to preserve a more specific Patreon profile shape.
PatreonProfileOAuthConfigOAuthUserConfigcustomizing a built-in OAuth provider