google strategy to authenticate users with their Google accounts. This is a preset of the generic OAuth flow with Google’s endpoints pre-configured.
Creating a Google OAuth Client
- Go to the Google Cloud Console
- Select or create a project
- Navigate to APIs & Services > Credentials
- Click Create Credentials > OAuth client ID
- For Application type, select Web application
- Configure the authorized redirect URI:
- For production:
https://your-domain.com/oauth/provider-callback - For local development:
http://localhost:3000/oauth/provider-callback
- For production:
- Copy the Client ID and Client Secret
Environment Setup
Preset Values
You can override any preset with explicit
OAUTH_* values.
Example: Google Sheets + Drive
Available Scopes
Tool Context
WhenAUTH_STRATEGY=google, successful authentication populates the tool context with:
context.providerToken— the Google access tokencontext.resolvedHeaders—{ Authorization: "Bearer <google-access-token>" }context.provider— provider info object withaccessToken,refreshToken,expiresAt,scopescontext.authStrategy—"google"
Example Tool
Additional Options
Offline Access
To receive a refresh token (for long-lived access), addaccess_type=offline to extra auth params:
Force Consent
To force the consent screen to appear every time:Getting User Info
Usecontext.getUser() to fetch the authenticated user’s profile from Google:
getUser helper with USERINFO_ENDPOINTS:
USERINFO_ENDPOINTS constant provides pre-configured URLs:
Access Google ID Token Claims
When using Google OAuth, theid_token is automatically decoded and available via context.provider?.idTokenClaims:
email- User’s email addressname- User’s full namepicture- URL to user’s profile picturesub- User’s unique Google ID