Google OAuth
Google OAuth allows users to sign in to your application using their Google accounts.
Google OAuth allows users to sign in to your application using their Google accounts.
Prerequisites
To use Google OAuth, you need to create a project in the Google Cloud Console and obtain a Client ID and Client Secret.
- Go to the Google Cloud Console.
- Create a new project or select an existing one.
- Navigate to APIs & Services > Credentials.
- Click Create Credentials and select OAuth client ID.
- Configure the OAuth consent screen if you haven't already.
- For Application type, select Web application.
- Add your application's base URL to Authorized JavaScript origins.
- Add the Better Auth callback URL to Authorized redirect URIs. This is typically
https://yourdomain.com/api/auth/callback/google.
Environment Variables
Add your Google credentials to your .env (and .env.local) file:
AUTH_GOOGLE_ID=your_google_client_id
AUTH_GOOGLE_SECRET=your_google_client_secretConfiguration
The Google provider is automatically enabled in packages/backend/convex/auth.ts if the environment variables are present:
socialProviders: {
google: {
clientId: env.AUTH_GOOGLE_ID,
clientSecret: env.AUTH_GOOGLE_SECRET,
},
},Magic Links
Magic links provide a passwordless authentication experience. Users enter their email address, and the application sends them a secure, single-use link. Clicking the link authenticates the user.
Microsoft OAuth
Microsoft OAuth allows users to sign in using their Microsoft Entra ID (formerly Azure AD) accounts. This is particularly useful for B2B applications where users sign in with their corporate accounts.