MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / stripIdToken

Function stripIdToken

packages/core/sdk/src/oauth-helpers.ts:469–486  ·  view source on GitHub ↗
(response: Response)

Source from the content-addressed store, hash-verified

467// its claims against the AS metadata and rejects mismatches we don't care
468// about. Strip the field before delegation.
469const stripIdToken = async (response: Response): Promise<Response> => {
470 const body = await response
471 .clone()
472 .json()
473 .then(
474 (value: unknown) => value,
475 () => null,
476 );
477 if (!body || typeof body !== "object" || !("id_token" in (body as Record<string, unknown>))) {
478 return response;
479 }
480 const { id_token: _ignored, ...rest } = body as Record<string, unknown>;
481 return new Response(JSON.stringify(rest), {
482 status: response.status,
483 statusText: response.statusText,
484 headers: response.headers,
485 });
486};
487
488const processTokenEndpointResponse = async (
489 as: oauth.AuthorizationServer,

Callers 2

refreshAccessTokenFunction · 0.85

Calls 2

jsonMethod · 0.65
cloneMethod · 0.65

Tested by

no test coverage detected