MJO · Essay 3
Sign-up inside OAuth: how to stop losing people at the consent screen
The moment a person connects your MCP server from Claude or ChatGPT, a browser opens on your sign-in page. If they have no account yet, that page decides whether they become a user or close the tab.
Most authorization servers were built for people who already have an account. They show a sign-in form, perhaps a "create account" link that leads to a separate sign-up flow, and after sign-up they send the person to the product's dashboard. On the web that is fine. Inside an MCP connection it breaks the journey: the AI client is still waiting for an authorization code that will never come, and the person is now on a page that has nothing to do with the chat they left.
This essay is about the Authorize stage of the MJO funnel. Every technical claim below comes from the MCP authorization spec (2025-11-25), Claude's connector authentication docs or OpenAI's MCP auth docs, linked where I use them.
The loop, end to end
Step 1: answer with a 401 that says where to go
The client's first request to your server has no token. Your server answers 401 Unauthorized with a WWW-Authenticate header whose resource_metadata parameter points to your protected resource metadata document (RFC 9728). The MCP spec makes the metadata a requirement for servers and requires clients to use it to find the authorization server.
Two practical points. Claude requires the 401; it ignores a WWW-Authenticate header on a 200 (Claude). And if your 401 carries no pointer, clients fall back to probing /.well-known/oauth-protected-resource under your MCP path and then at the root. Claude's docs call that a fallback that only works when your platform serves /.well-known/*. The pointer is the reliable path.
The spec also says servers should add a scope parameter to that header, "following the principle of least privilege". Remember that; it comes back at consent.
Step 2: publish both metadata documents
The protected resource metadata names your authorization server in authorization_servers. Its resource field is the canonical address of your MCP server; Claude says it must equal the URL "as the user enters it in Claude, including any path component". If you list more than one authorization server, Claude uses the first and does not fall back to later entries.
Your authorization server then publishes its own metadata, either RFC 8414 or OpenID Connect Discovery. It must advertise code_challenge_methods_supported with S256. The MCP spec tells clients to refuse to proceed if that field is absent, and OpenAI's docs say a server without it is unsupported. Every authorization request from Claude carries an S256 PKCE challenge.
Step 3: let the client register itself
A person should be able to connect with nothing but your server's address. That means the client has to get a client ID without anyone filling in a form. There are two ways:
| Method | How it works | What the docs say |
|---|---|---|
| Client ID Metadata Document (CIMD) | The client's client_id is an HTTPS URL to a JSON document with its name and redirect URIs; your server fetches it. | The 2025-11-25 spec ranks it ahead of DCR. OpenAI calls it "the preferred client registration method". Claude uses it when your metadata advertises client_id_metadata_document_supported: true and none in token_endpoint_auth_methods_supported. |
| Dynamic Client Registration (DCR) | The client posts to your registration_endpoint (RFC 7591) and gets a client ID back. | Now a may in the spec, kept "for backwards compatibility". Claude falls back to it. Claude warns that DCR registers a new client on every fresh connection; ChatGPT registers once per connection and reuses it. |
Support both if you can. Neither involves the person, which is the point: the connector dialog stays a single paste.
Step 4: keep the request before you ask who they are
Now the browser arrives at your authorize endpoint with a client ID, a redirect URI, a PKCE challenge, a state and a resource parameter. The MCP spec requires clients to send resource in both the authorization and token requests, and requires your server to check that tokens were issued for it.
This is the step most sign-up flows get wrong. Before you show any sign-in or sign-up page, validate the request and store it on the server. Then hand the browser something that points to it. If the person wanders off to create an account, verify their email or reset a password, the request is still there when they come back.
At CrushedWithIt this is how the authorize step works. It validates the request first: an unknown client or an unregistered redirect gets an error page and is never sent to that redirect. It holds the pending request on the server, tied to the browser that started it, and sends that browser to the web app's sign-in. Signed-in people go straight through. Signed-out people sign in or create an account on the web app, which then returns the same browser to the authorize step to finish. The pending request expires quickly, and it cannot be finished from a different browser.
You do not need our exact mechanism. You need the property: the authorization request survives sign-up.
Step 5: put sign-up on the sign-in page
The person who arrives here from Claude or ChatGPT has often never seen your product. Treat this page as a landing page with one job.
- Say why they are here. "Connect crushedwithit to Claude" is clearer than "Sign in". Name the client if your redirect URI tells you which it is.
- Offer both paths on one page. Sign in and create account side by side, not a link to a different flow.
- Ask for the minimum. An email and a one-time code, or a single identity provider button. Profile questions can wait until after the first result.
- Keep verification in place. If you send a code by email, let them type it on the same page. A link tapped in a mail app can open a different browser from the one holding the request.
- Return to the request, never to the dashboard. After sign-up, the next screen is consent.
If you have tools that work without an account, there is another option. Claude supports lazy authentication, where people use the open tools first and sign in only when Claude reaches a tool that needs their account. OpenAI lets each tool declare noauth, oauth2 or both in its securitySchemes. Deferring sign-up until it is needed moves this whole step later in the journey, after the person has seen value.
Step 6: a consent screen that asks for less
Consent is where people who got this far still leave, usually because the list of permissions looks like more than they came for.
The spec's scope selection is the lever. Clients should use the scope from your 401 header if you give one; if you do not, they ask for everything in your scopes_supported. The spec says scopes_supported is meant to be "the minimal set of scopes necessary for basic functionality", with more requested later through step-up: your server answers a call that needs more with 403, error="insufficient_scope" and the scopes required, and the client asks again. Claude follows the same rule: the scope in your 401, else scopes_supported, plus offline_access if your authorization server lists it, to get a refresh token.
So the design move is simple: advertise read-only scopes as the baseline and ask for write or spend scopes when the first tool that needs them is called.
On the page itself:
- Write scopes as sentences. CrushedWithIt's consent page shows "See your plan, credits left and this app's monthly limit", not
account:read. - Show money apart. The scope that spends credits sits in its own group with a monthly spending limit the person picks, with a modest default preselected.
- Show who is asking. The spec requires the authorization server to display the redirect URI's hostname, and to warn when every redirect is a loopback address. Our page shows the client's domain and redirect host in plain text, and warns on loopback.
- Do not ask twice. An existing grant for the same client that covers every requested scope and the same redirect gets a code with no page. Wider scopes or a new redirect ask again.
- Drop what you cannot grant, quietly. Some clients ask for
openid,emailandprofileby default. We do not run OpenID Connect, so we drop those rather than fail the request; the token response'sscopesays what was granted. If you do run OIDC, OpenAI notes that each advertised OIDC scope must be enabled for the client.
Step 7: the token, and the way back
After Allow, your server redirects to the client's registered redirect URI with the code and the original state. The client exchanges the code at your token endpoint with its PKCE verifier and the resource, and retries the MCP request with the token.
Know which redirect URIs to accept. Claude's hosted apps use https://claude.ai/api/mcp/auth_callback; Claude Code uses a loopback redirect on a port that changes per session, so match localhost and 127.0.0.1 with the port ignored. ChatGPT uses https://chatgpt.com/connector_platform_oauth_redirect when your server supports RFC 9207 iss identification, and a per-connector callback otherwise (OpenAI).
Know the clock too. Claude waits up to 10 seconds for discovery, registration and token endpoints and treats anything slower as a failure. Your token endpoint must accept application/x-www-form-urlencoded; a JSON-only parser returns 415 and the connection fails.
The browser tab is now a dead end: the code went to the client, and the person's attention should go back to the chat. Your closing page should say so in one line, "You're connected. Go back to Claude.", and nothing else.
Close the loop on your own page
Many people do not start in the client. They start on your site, follow instructions, and switch to Claude or ChatGPT to paste the address. When the OAuth loop finishes, they are in the client, but your setup page is still open in another tab, asking nothing.
CrushedWithIt's MCP sign-up page, shipped today, closes that gap. After sign-in it asks which client you use, shows only that client's steps with a Copy address and an Open button, then waits. While the tab is visible it checks every three seconds for a new grant on the account, for up to ten minutes, and moves on by itself when the grant lands. Nobody has to press "I've connected". The next step offers credits in place, or a skip, and the last gives a starter prompt ready to copy into the chat.
That waiting step turns an invisible success into a visible one, and gives us a clean mjo_authorized event tied to the page that started the journey. The event schema essay covers how to log it.
A checklist for MCP OAuth sign-up
| Check | Why |
|---|---|
401 with resource_metadata on every unauthenticated request | Discovery works on any platform |
resource equals the address people paste | Claude matches it exactly |
Your issuer listed first in authorization_servers | Claude uses only the first |
S256 in code_challenge_methods_supported | Clients refuse to proceed without it |
| CIMD and DCR supported | Connect with just the address |
| Authorize request stored before sign-in | Sign-up does not lose the journey |
| Sign-up on the same page as sign-in | New people are not sent elsewhere |
| Read-only baseline scopes; step-up for the rest | Consent asks for less |
| Redirect host shown on consent | Required by the spec; builds trust |
| Endpoints answer well under 10 seconds | Claude's limit |
| A closing page that says "go back to the chat" | The person knows where to look |
A sign-up that forgets why the person arrived is not a sign-up. It is a detour.
Authorization is one of the seven stages in MCP Journey Optimization, and the one where the protocol is clearest about what you must do and quietest about what the person sees. The protocol gets the token to the client. Whether a new person reaches the token at all is a design problem, and in MJO it is yours.
Keep reading: the MJO definition, framework and FAQ · the seven-stage funnel · the first tool call.