How to authenticate with OAuth
This guide shows you how to sign a user in through Google.
1. Get the authorization URL
mutation {
oauthAuthorize(input: {
provider: GOOGLE
redirectUrl: "https://app.example.com/auth/callback"
scopes: ["openid", "email", "profile"]
}) {
url
}
}2. Send the user to that URL
Google authenticates the user and sends them back with a code parameter.
3. Exchange the code
mutation {
oauthCallback(input: { provider: GOOGLE, code: "auth-code-from-google" }) {
session { accessToken refreshToken expiresAt }
}
}API and MCP
You can also do this task with the Management API, the MCP server, or code that you send to picked_run.
| Task | GraphQL | MCP tool | Run |
|---|---|---|---|
| Get the authorization URL | oauthAuthorize | None | None |
| Exchange the code | oauthCallback | None | None |
Related
- Authentication — every mutation.
