Social sign-in
Users authenticate with Reddit instead of creating a local password.
Better Auth · Const
reddit is Better Auth’s provider identifier for Reddit OAuth sign-in. Configure Reddit credentials under socialProviders.reddit, then pass provider: "reddit" to signIn.social.
The reddit identifier selects Better Auth's Reddit OAuth provider. Add Reddit credentials under socialProviders.reddit, then pass provider: "reddit" to the client's social sign-in method to begin authentication.
provider: "reddit"| Name | Type | Description |
|---|---|---|
provider | string | The configured social provider to use; for this integration, set it to reddit. |
The page does not specify a distinct return type; the sign-in example awaits the result of authClient.signIn.social.
socialProviders configuration.clientId option.clientSecret option.provider property to choose the social provider.reddit.import { betterAuth } from "better-auth";
import { createAuthClient } from "better-auth/client";
export const auth = betterAuth({
socialProviders: {
reddit: {
clientId: process.env.REDDIT_CLIENT_ID as string,
clientSecret: process.env.REDDIT_CLIENT_SECRET as string,
},
},
});
const authClient = createAuthClient();
await authClient.signIn.social({ provider: "reddit" });Configure Reddit credentials on the server, then start OAuth sign-in with the Reddit provider identifier.
Users authenticate with Reddit instead of creating a local password.
An application needs Reddit account or content permissions.
A server configures OAuth credentials for a Reddit web application.
The reddit value identifies Reddit in Better Auth's social-provider configuration and sign-in API. Configure clientId and clientSecret in socialProviders.reddit, then call signIn.social with provider: "reddit".
Follow-up: What credentials are required? Reddit requires a client ID and client secret, obtained from the Reddit Developer Portal.
The redirect URL must point to Better Auth's Reddit callback route. For local development, the documented route is http://localhost:3000/api/auth/callback/reddit; production should use the application's domain.
Follow-up: Why must the production URL differ? OAuth providers redirect users back to the registered application domain, so the production callback must match that deployment.
Provider scopes are configured inside the Reddit provider options with the scope array. Examples include identity for basic account information, read for posts and comments, and submit for submitting posts and comments.
Follow-up: How would you request additional Reddit permissions? Add the required Reddit scope names to the provider's scope array.
socialProvidersclientIdclientSecretsignIn.socialscopecreateAuthClient