MCPcopy Create free account
hub / github.com/cloudflare/mcp / authErrorMessage

Function authErrorMessage

src/auth/oauth-handler.ts:59–69  ·  view source on GitHub ↗

Format an unknown thrown value into a stable `auth_user` error message.

(prefix: string, e: unknown)

Source from the content-addressed store, hash-verified

57
58/**
59 * Refresh the upstream Cloudflare grant when workers-oauth-provider refreshes
60 * its downstream access token. The per-grant admission gate rejects competing
61 * provider exchanges so they cannot independently rotate downstream tokens.
62 */
63export async function handleTokenExchangeCallback(
64 options: TokenExchangeCallbackOptions,
65 clientId: string,
66 clientSecret: string,
67 getHelpers?: () => OAuthHelpers
68): Promise<TokenExchangeCallbackResult | undefined> {
69 if (options.grantType !== 'refresh_token') return undefined
70
71 const props = AuthPropsSchema.parse(options.props)
72 if (props.type !== 'user_token' || !props.refreshToken) return undefined

Callers 1

createAuthHandlersFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected