Format an unknown thrown value into a stable `auth_user` error message.
(prefix: string, e: unknown)
| 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 | */ |
| 63 | export 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 |
no outgoing calls
no test coverage detected