MCPcopy Index your code
hub / github.com/modelcontextprotocol/typescript-sdk / applyBasicAuth

Function applyBasicAuth

src/client/auth.ts:342–349  ·  view source on GitHub ↗

* Applies HTTP Basic authentication (RFC 6749 Section 2.3.1)

(clientId: string, clientSecret: string | undefined, headers: Headers)

Source from the content-addressed store, hash-verified

340 * Applies HTTP Basic authentication (RFC 6749 Section 2.3.1)
341 */
342function applyBasicAuth(clientId: string, clientSecret: string | undefined, headers: Headers): void {
343 if (!clientSecret) {
344 throw new Error('client_secret_basic authentication requires a client_secret');
345 }
346
347 const credentials = btoa(`${clientId}:${clientSecret}`);
348 headers.set('Authorization', `Basic ${credentials}`);
349}
350
351/**
352 * Applies POST body authentication (RFC 6749 Section 2.3.1)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…