# Passport.Me auth.md

How an AI agent gets a credential to act for a Passport.Me user.

Passport.Me has no anonymous or agent-only accounts. Every credential acts for one person, who signs in and approves the agent on a consent screen. Registering needs no API key and no prior arrangement.

There are two ways in: the OAuth authorization code flow (Steps 1 to 3), for agents that can open a browser and receive a redirect, or agentic registration with the user's email (below), for agents that can only show the user a link and a code.

## Who this is for
AI agents and MCP clients (Claude, ChatGPT, Cursor, or your own agent) that read a person's connected data through Passport.Me: Gmail, Calendar, Drive, Docs, Sheets, Contacts, GitHub, wallet activity, confirmed profile facts and AI memories.

## Discovery
- Protected resource metadata: https://passport.me/.well-known/oauth-protected-resource
- Authorization server metadata: https://passport.me/.well-known/oauth-authorization-server
- MCP endpoint: https://mcp.passport.me/mcp (streamable HTTP)

## Step 1: register your client
Pick one. Neither needs a client secret.
- Client ID Metadata Document: use an https URL that serves your client metadata as your `client_id`.
- Dynamic Client Registration (RFC 7591): `POST https://passport.me/register` with a JSON body holding `redirect_uris` and `client_name`. The response carries your `client_id`.

Redirect URIs must be http on localhost or 127.0.0.1, https on a known AI-client host, or a Chrome extension's chromiumapp.org URL. An extension other than Passport.Me's own waits for review before it can sign in.

## Step 2: get the user's approval
Authorization code flow with PKCE (S256). Clients are public: `token_endpoint_auth_method` is `none`.
1. Send the user to `https://passport.me/oauth/authorize` with `response_type=code`, your `client_id` and `redirect_uri`, `code_challenge` with `code_challenge_method=S256`, `scope=passport.mcp` and a `state` value.
2. The user signs in to Passport.Me and approves your agent. Write access (`passport.mcp.write`) is granted only if they tick a change on the consent screen, and only for the changes ticked.
3. Exchange the code at `https://passport.me/oauth/token` with `grant_type=authorization_code` and your `code_verifier`.

## Step 3: use the credential
- `access_token`: send it as `Authorization: Bearer <token>` to https://mcp.passport.me/mcp. It does not expire: it works until the user disconnects this app in Passport.Me.
- `refresh_token`: exchange it at `https://passport.me/oauth/token` with `grant_type=refresh_token` for a new pair. Each refresh token works once and does not expire.

Scopes: `passport.mcp` reads the user's connected sources. `passport.mcp.write` covers only the kinds of change the user turned on for your app, such as Create calendar events or Edit Google Sheets, and holding it does not mean any is on. Each kind is a separate opt-in and must also be on in the user's Sources.

## Agentic registration with the user's email
The `agent_auth` block in the authorization server metadata advertises this. The only method is verified email (`service_auth`); `anonymous` returns `anonymous_not_enabled` and ID-JAG assertions are not accepted.
1. `POST https://passport.me/agent/identity` with JSON `{"type":"service_auth","login_hint":"<the user's email>"}`. The response holds a `claim_token` (keep it, it is returned once) and a `claim` block with a 6-digit `user_code` and a `verification_uri`. Passport.Me sends no email.
2. Show the user the `verification_uri` and the `user_code`. They sign in to Passport.Me with that email address, type the code, and choose what to share. Another account cannot claim it. Write access is granted only for the changes they tick.
3. Poll `https://passport.me/oauth/token` with `grant_type=urn:workos:agent-auth:grant-type:claim` and your `claim_token`, no faster than every 5 seconds. You get `authorization_pending`, `slow_down`, `access_denied` or `expired_token` until the user approves, then the same `access_token` and `refresh_token` as Step 3. Tokens are issued once; the claim_token is then spent.

The code lasts 10 minutes and allows 5 wrong tries. If it expires, `POST https://passport.me/agent/identity/claim` with `{"claim_token":"…","email":"<same email>"}` for a new one. The registration lasts 1 hour; after that, register again. There is no jwt-bearer `identity_assertion`: refresh with the `refresh_token`.

## Revocation
The user can disconnect your agent at any time from their dashboard at https://my.passport.me. Its access and refresh tokens stop working at once, and a refresh returns `invalid_grant`.
