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

Function getHeaders

packages/infra/src/internal/auth.ts:7–11  ·  view source on GitHub ↗
(error: string, description: string, scopes?: ReadonlyArray<string>)

Source from the content-addressed store, hash-verified

5import { createRemoteJWKSet, jwtVerify } from "jose"
6
7const getHeaders = (error: string, description: string, scopes?: ReadonlyArray<string>) => ({
8 "WWW-Authenticate": `Bearer realm="api", error="${error}", error_description="${description.replace(/"/g, "'")}"${
9 scopes ? `, scope="${scopes.join(" ")}"` : ""
10 }`
11})
12
13export class UnauthorizedError extends Error {
14 readonly status: number = 401

Callers 3

constructorMethod · 0.85
constructorMethod · 0.85
constructorMethod · 0.85

Calls 2

joinMethod · 0.80
replaceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…