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/twitter

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

Twitter provider setup redirect URL

To set up Twitter sign-in, configure the redirect URL in the Twitter Developer Portal to http://localhost:3000/api/auth/callback/twitter for local development. For production, set it to your application's URL. If you change the base path of the auth routes, you must update the redirect URL accordingly.

Twitter API v2 email scope requirement

Twitter API v2 now supports email address retrieval. You must request the user.email scope when configuring your Twitter app to enable email address retrieval during authentication.

Twitter provider configuration parameters

To configure the Twitter provider in Better Auth, import betterAuth and pass the provider configuration to the socialProviders option. The Twitter provider requires two parameters: clientId (from TWITTER_CLIENT_ID environment variable) and clientSecret (from TWITTER_CLIENT_SECRET environment variable).

Twitter provider configuration example

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

Twitter sign-in with client

To sign in with Twitter on the client side, use the signIn.social function from the auth client with the provider set to "twitter". This initiates the Twitter OAuth flow.

Twitter sign-in client example

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

Give your agent this brain