1. Create a project and consent screen
- Open the Google Cloud Console and create or select a project.
- Go to APIs & Services → OAuth consent screen (Google Auth Platform). Choose External, fill in the app name, support email and developer contact, and add the
email,profileandopenidscopes. - While the app is in Testing, only listed test users can sign in. Publish it before launch.
2. Create the OAuth client
- Go to APIs & Services → Credentials → Create credentials → OAuth client ID.
- Application type: Web application.
- Authorized JavaScript origins:
http://localhost:3000https://your-domain.com
- Authorized redirect URIs:
http://localhost:3000/api/auth/callback/googlehttps://your-domain.com/api/auth/callback/google
- Click Create and copy the client ID and secret.
3. Configure the app
NEXT_PUBLIC_AUTH_GOOGLE=true
AUTH_GOOGLE_CLIENT_ID="1234567890-abc.apps.googleusercontent.com"
AUTH_GOOGLE_CLIENT_SECRET="GOCSPX-..."
Set EXPO_PUBLIC_AUTH_GOOGLE and VITE_AUTH_GOOGLE too if you use the native apps (pnpm doctor derives them). The doctor checks that the client ID ends with .apps.googleusercontent.com.
Troubleshooting
redirect_uri_mismatch: the redirect URI must match exactly, includinghttpvshttpsand no trailing slash. It is built fromNEXT_PUBLIC_URL.- "Access blocked: app has not completed verification": add the account as a test user, or publish the consent screen.
