new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Better Auth · Authentication · all subjects

social sign-on/discord

7 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Discord OAuth redirect URL for local development

For local development, set the Discord redirect URL to http://localhost:3000/api/auth/callback/discord. For production, set it to the URL of your application. If you change the base path of the auth routes, update the redirect URL accordingly.

Discord provider configuration in Better Auth

To configure Discord sign-on, import betterAuth and pass a socialProviders object with a discord property containing clientId and clientSecret from the Discord Developer Portal.

Discord sign-in code example

import { betterAuth } from "better-auth" export const auth = betterAuth({ socialProviders: { discord: { clientId: process.env.DISCORD_CLIENT_ID as string, clientSecret: process.env.DISCORD_CLIENT_SECRET as string, }, }, })

Discord sign-in with client example

import { createAuthClient } from "better-auth/client" const authClient = createAuthClient() const signIn = async () => { const data = await authClient.signIn.social({ provider: "discord" }) }

Discord email scope returns null for phone-only accounts

Discord returns email: null for phone-only accounts, even when the email scope is granted. Refer to Handling Providers Without Email documentation for recommended mapProfileToUser fallback configuration.

Discord bot permissions option

When using the bot scope with Discord OAuth, you can specify bot permissions using the permissions option. This accepts either a bitwise value (e.g., 2048 | 16384 for Send Messages and Embed Links) or a specific permission value (e.g., 16384 for Embed Links). The permissions parameter only works when the bot scope is included in your OAuth2 scopes.

Discord bot permissions configuration example

import { betterAuth } from "better-auth" export const auth = betterAuth({ socialProviders: { discord: { clientId: process.env.DISCORD_CLIENT_ID as string, clientSecret: process.env.DISCORD_CLIENT_SECRET as string, permissions: 2048 | 16384, }, }, })

Give your agent this brain