Get credentials
1
Create a project
Go to Google Cloud Console and create a new project (or select an existing one).2
Enable the People API
Navigate to APIs and Services > Library, search for “Google People API”, and enable it. This is only needed if you plan to call the People API yourself; sign-in reads the profile from the OpenID userinfo endpoint.3
Create OAuth credentials
Go to APIs and Services > Credentials > Create Credentials > OAuth client ID.- Application type: Web application
- Authorized redirect URIs:
https://auth.example.com/auth/oauth/callback/google
4
Configure the consent screen
Under OAuth consent screen, set the app name, support email, and authorized domain. For production, submit for verification if you need access to sensitive scopes.Configuration
lib/theauth.ts
Scopes
Default scopes:openid email profile. Scopes you pass are added on top of the defaults.
These give you name, email, and profile picture. To request additional permissions:
Extra scopes beyond
openid email profile require your app to complete Google’s verification process before they work for users outside your organization.access_type=offline and prompt=consent, so Google returns a refresh token and shows the consent screen on every sign-in.
User data returned
Initiating sign-in
Redirect users to:{baseUrl}/. There is no redirectTo parameter.
Related
Google One-tap
One-tap sign-in widget that uses Google ID tokens server-side.
OAuth overview
Generic OAuth 2.0 setup and account linking behavior.
Apple
Sign in with Apple for iOS apps and web.
Authentication overview
All sign-in methods available in theAuth.