MCPcopy Create free account
hub / github.com/effect-app/libs / fetchDiscoveryDocumentPromise

Function fetchDiscoveryDocumentPromise

packages/infra/src/internal/auth.ts:119–129  ·  view source on GitHub ↗
(issuerBaseURL: string)

Source from the content-addressed store, hash-verified

117}
118
119const fetchDiscoveryDocumentPromise = async (issuerBaseURL: string) => {
120 const response = await fetch(buildDiscoveryUrl(issuerBaseURL))
121 if (!response.ok) {
122 throw new Error(`Failed to fetch authorization server metadata: ${response.status}`)
123 }
124 const json = await response.json()
125 if (!isRecord(json) || typeof json["issuer"] !== "string" || typeof json["jwks_uri"] !== "string") {
126 throw new Error("Invalid authorization server metadata")
127 }
128 return { issuer: json["issuer"], jwksUri: json["jwks_uri"] }
129}
130
131const getAuthorizationToken = (headers: HttpHeaders.Headers, authRequired: boolean) => {
132 const authorization = HttpHeaders.get(headers, "authorization")

Callers 1

makeResolveConfigFunction · 0.85

Calls 4

buildDiscoveryUrlFunction · 0.85
isRecordFunction · 0.70
jsonMethod · 0.65
fetchFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…