Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

auth.ts

552 lines20.2 KB

1import * as Schema from "effect/Schema";
2import * as HttpApiSchema from "effect/http-api/HttpApiSchema";
3​
4import {
5 AuthSessionId,
6 ForwardCompatibleArray,
7 ClientSurface,
8 ClientWebDeployment,
9 TrimmedNonEmptyString,
10} from "./baseSchemas.ts";
11​
12export const ServerAuthPolicy = Schema.Literals([
13 "desktop-managed-local",
14 "loopback-browser",
15 "remote-reachable",
16 "unsafe-no-auth",
17]);
18export type ServerAuthPolicy = typeof ServerAuthPolicy.Type;
19​
20export const ServerAuthBootstrapMethod = Schema.Literals(["desktop-bootstrap", "one-time-token"]);
21export type ServerAuthBootstrapMethod = typeof ServerAuthBootstrapMethod.Type;
22​
23export const ServerAuthSessionMethod = Schema.Literals([
24 "browser-session-cookie",
25 "bearer-access-token",
26 "dpop-access-token",
27]);
28export type ServerAuthSessionMethod = typeof ServerAuthSessionMethod.Type;
29​
30export const AuthOrchestrationReadScope = "orchestration:read" as const;
31export const AuthOrchestrationOperateScope = "orchestration:operate" as const;
32export const AuthSettingsWriteScope = "settings:write" as const;
33export const AuthProvidersManageScope = "providers:manage" as const;
34export const AuthEnvironmentMaintainScope = "environment:maintain" as const;
35export const AuthPreviewOperateScope = "preview:operate" as const;
36export const AuthDiagnosticsReadScope = "diagnostics:read" as const;
37export const AuthTerminalReadScope = "terminal:read" as const;
38export const AuthTerminalOperateScope = "terminal:operate" as const;
39export const AuthSourceControlWriteScope = "source-control:write" as const;
40export const AuthFilesystemReadScope = "filesystem:read" as const;
41export const AuthFilesystemWriteScope = "filesystem:write" as const;
42/** Retained for decoding existing credentials; grants no current RPC access. */
43const AuthReviewWriteScope = "review:write" as const;
44export const AuthAccessReadScope = "access:read" as const;
45export const AuthAccessWriteScope = "access:write" as const;
46export const AuthRelayReadScope = "relay:read" as const;
47export const AuthRelayWriteScope = "relay:write" as const;
48export const AuthEnvironmentScope = Schema.Literals([
49 AuthOrchestrationReadScope,
50 AuthOrchestrationOperateScope,
51 AuthSettingsWriteScope,
52 AuthProvidersManageScope,
53 AuthEnvironmentMaintainScope,
54 AuthPreviewOperateScope,
55 AuthDiagnosticsReadScope,
56 AuthTerminalReadScope,
57 AuthTerminalOperateScope,
58 AuthFilesystemReadScope,
59 AuthFilesystemWriteScope,
60 AuthReviewWriteScope,
61 AuthSourceControlWriteScope,
62 AuthAccessReadScope,
63 AuthAccessWriteScope,
64 AuthRelayReadScope,
65 AuthRelayWriteScope,
66]);
67export type AuthEnvironmentScope = typeof AuthEnvironmentScope.Type;
68export const AuthEnvironmentScopes = Schema.Array(AuthEnvironmentScope);
69export type AuthEnvironmentScopes = typeof AuthEnvironmentScopes.Type;
70​
71export const AuthGrantScope = Schema.Literals(
72 AuthEnvironmentScope.literals.filter((scope) => scope !== AuthReviewWriteScope),
73);
74export type AuthGrantScope = typeof AuthGrantScope.Type;
75export const AuthGrantScopes = Schema.Array(AuthGrantScope);
76export type AuthGrantScopes = typeof AuthGrantScopes.Type;
77​
78const legacyScopes = new Set<AuthEnvironmentScope>([
79 AuthOrchestrationReadScope,
80 AuthOrchestrationOperateScope,
81 AuthTerminalOperateScope,
82 AuthReviewWriteScope,
83 AuthAccessReadScope,
84 AuthAccessWriteScope,
85 AuthRelayReadScope,
86 AuthRelayWriteScope,
87]);
88​
89export function authScopeResponse(scopes: ReadonlyArray<AuthEnvironmentScope>) {
90 return { scopes: scopes.filter((scope) => legacyScopes.has(scope)), permissions: scopes };
92​
93const authScopeResponseFields = {
94 scopes: AuthEnvironmentScopes,
95 permissions: Schema.optionalKey(ForwardCompatibleArray(AuthEnvironmentScope)),
96};
97​
98// Only clients talking to an old server use these parent checks. Servers never
99// expand stored grants, and an explicitly empty permissions array grants nothing.
100const legacyParents: Partial<Record<AuthEnvironmentScope, AuthEnvironmentScope>> = {
101 [AuthFilesystemReadScope]: AuthOrchestrationReadScope,
102 [AuthDiagnosticsReadScope]: AuthOrchestrationReadScope,
103 [AuthSettingsWriteScope]: AuthOrchestrationOperateScope,
104 [AuthProvidersManageScope]: AuthOrchestrationOperateScope,
105 [AuthEnvironmentMaintainScope]: AuthOrchestrationOperateScope,
106 [AuthPreviewOperateScope]: AuthOrchestrationOperateScope,
107 [AuthSourceControlWriteScope]: AuthOrchestrationOperateScope,
108 [AuthFilesystemWriteScope]: AuthOrchestrationOperateScope,
109 [AuthTerminalReadScope]: AuthTerminalOperateScope,
110};
111​
112/** Keep permission denials decodable by clients with the original scope enum. */
113export function authScopeRequiredResponse(requiredPermission: AuthEnvironmentScope) {
114 return {
115 requiredScope: legacyParents[requiredPermission] ?? requiredPermission,
116 requiredPermission,
117 };
119​
120export interface SessionGrantInput {
121 readonly authenticated: boolean;
122 readonly scopes?: ReadonlyArray<AuthEnvironmentScope> | undefined;
123 readonly permissions?: ReadonlyArray<AuthEnvironmentScope> | undefined;
124 readonly auth?: { readonly serverUpdateScope?: string | undefined } | undefined;
126​
127export function sessionGrantsScope(
128 session: SessionGrantInput,
129 scope: AuthEnvironmentScope,
130): boolean {
131 if (!session.authenticated) return false;
132 if (session.permissions !== undefined) return session.permissions.includes(scope);
133 if (session.scopes?.includes(scope)) return true;
134 if (session.auth?.serverUpdateScope !== undefined) return false;
135 const parent = legacyParents[scope];
136 return parent !== undefined && session.scopes?.includes(parent) === true;
138​
139export function sessionHasLegacyPermissions(session: SessionGrantInput): boolean {
140 const permissions = session.permissions;
141 return (
142 session.authenticated &&
143 permissions !== undefined &&
144 permissions.every((scope) => legacyScopes.has(scope)) &&
145 Object.values(legacyParents).some((parent) => permissions.includes(parent))
146 );
148​
149export const AuthStandardClientScopes = [
150 AuthOrchestrationReadScope,
151 AuthOrchestrationOperateScope,
152 AuthSettingsWriteScope,
153 AuthProvidersManageScope,
154 AuthEnvironmentMaintainScope,
155 AuthPreviewOperateScope,
156 AuthDiagnosticsReadScope,
157 AuthTerminalReadScope,
158 AuthTerminalOperateScope,
159 AuthSourceControlWriteScope,
160 AuthFilesystemReadScope,
161 AuthFilesystemWriteScope,
162 AuthRelayReadScope,
163] as const;
164export const AuthAdministrativeScopes = [
165 ...AuthStandardClientScopes,
166 AuthAccessReadScope,
167 AuthAccessWriteScope,
168 AuthRelayWriteScope,
169] as const;
170​
171export const AuthTokenExchangeGrantType =
172 "urn:ietf:params:oauth:grant-type:token-exchange" as const;
173export const AuthAccessTokenType = "urn:ietf:params:oauth:token-type:access_token" as const;
174export const AuthEnvironmentBootstrapTokenType =
175 "urn:t3:params:oauth:token-type:environment-bootstrap" as const;
176​
177export const ServerAuthDescriptor = Schema.Struct({
178 policy: ServerAuthPolicy,
179 bootstrapMethods: Schema.Array(ServerAuthBootstrapMethod),
180 sessionMethods: Schema.Array(ServerAuthSessionMethod),
181 sessionCookieName: TrimmedNonEmptyString,
182 /** Older servers omit this and authorize self-updates with orchestration:operate. */
183 serverUpdateScope: Schema.optionalKey(Schema.Literal(AuthEnvironmentMaintainScope)),
184});
185export type ServerAuthDescriptor = typeof ServerAuthDescriptor.Type;
186​
187export const AuthBrowserSessionRequest = Schema.Struct({
188 credential: TrimmedNonEmptyString,
189});
190export type AuthBrowserSessionRequest = typeof AuthBrowserSessionRequest.Type;
191​
192export const AuthBrowserSessionResult = Schema.Struct({
193 authenticated: Schema.Literal(true),
194 ...authScopeResponseFields,
195 sessionMethod: ServerAuthSessionMethod,
196 expiresAt: Schema.DateTimeUtc,
197});
198export type AuthBrowserSessionResult = typeof AuthBrowserSessionResult.Type;
199​
200export const AuthClientMetadataDeviceType = Schema.Literals([
201 "desktop",
202 "mobile",
203 "tablet",
204 "bot",
205 "unknown",
206]);
207export type AuthClientMetadataDeviceType = typeof AuthClientMetadataDeviceType.Type;
208​
209export const AuthClientPresentationMetadata = Schema.Struct({
210 label: Schema.optionalKey(TrimmedNonEmptyString),
211 deviceType: Schema.optionalKey(AuthClientMetadataDeviceType),
212 os: Schema.optionalKey(TrimmedNonEmptyString),
213 osMajorVersion: Schema.optionalKey(Schema.Int),
214 deviceModel: Schema.optionalKey(TrimmedNonEmptyString),
215 surface: Schema.optionalKey(ClientSurface),
216 webDeployment: Schema.optionalKey(ClientWebDeployment),
217 browser: Schema.optionalKey(TrimmedNonEmptyString),
218 appVersion: Schema.optionalKey(TrimmedNonEmptyString),
219});
220export type AuthClientPresentationMetadata = typeof AuthClientPresentationMetadata.Type;
221​
222export const AuthTokenExchangeRequest = Schema.Struct({
223 grant_type: Schema.Literal(AuthTokenExchangeGrantType),
224 subject_token: TrimmedNonEmptyString,
225 subject_token_type: Schema.Literal(AuthEnvironmentBootstrapTokenType),
226 requested_token_type: Schema.Literal(AuthAccessTokenType),
227 scope: Schema.optionalKey(TrimmedNonEmptyString),
228 client_label: Schema.optionalKey(TrimmedNonEmptyString),
229 client_device_type: Schema.optionalKey(AuthClientMetadataDeviceType),
230 client_os: Schema.optionalKey(TrimmedNonEmptyString),
231}).pipe(HttpApiSchema.asFormUrlEncoded());
232export type AuthTokenExchangeRequest = typeof AuthTokenExchangeRequest.Type;
233​
234export const AuthAccessTokenResult = Schema.Struct({
235 access_token: TrimmedNonEmptyString,
236 issued_token_type: Schema.Literal(AuthAccessTokenType),
237 token_type: Schema.Literals(["Bearer", "DPoP"]),
238 expires_in: Schema.Number,
239 scope: TrimmedNonEmptyString,
240});
241export type AuthAccessTokenResult = typeof AuthAccessTokenResult.Type;
242​
243export const AuthWebSocketTicketResult = Schema.Struct({
244 ticket: TrimmedNonEmptyString,
245 expiresAt: Schema.DateTimeUtc,
246});
247export type AuthWebSocketTicketResult = typeof AuthWebSocketTicketResult.Type;
248​
249export const AuthPairingCredentialResult = Schema.Struct({
250 id: TrimmedNonEmptyString,
251 credential: TrimmedNonEmptyString,
252 label: Schema.optionalKey(TrimmedNonEmptyString),
253 expiresAt: Schema.DateTimeUtc,
254});
255export type AuthPairingCredentialResult = typeof AuthPairingCredentialResult.Type;
256​
257export const AuthPairingLink = Schema.Struct({
258 id: TrimmedNonEmptyString,
259 ...authScopeResponseFields,
260 subject: TrimmedNonEmptyString,
261 label: Schema.optionalKey(TrimmedNonEmptyString),
262 createdAt: Schema.DateTimeUtc,
263 expiresAt: Schema.DateTimeUtc,
264});
265export type AuthPairingLink = typeof AuthPairingLink.Type;
266​
267export const AuthClientMetadata = Schema.Struct({
268 label: Schema.optionalKey(TrimmedNonEmptyString),
269 ipAddress: Schema.optionalKey(TrimmedNonEmptyString),
270 userAgent: Schema.optionalKey(TrimmedNonEmptyString),
271 deviceType: AuthClientMetadataDeviceType,
272 os: Schema.optionalKey(TrimmedNonEmptyString),
273 browser: Schema.optionalKey(TrimmedNonEmptyString),
274});
275export type AuthClientMetadata = typeof AuthClientMetadata.Type;
276​
277export const AuthClientSession = Schema.Struct({
278 sessionId: AuthSessionId,
279 subject: TrimmedNonEmptyString,
280 ...authScopeResponseFields,
281 method: ServerAuthSessionMethod,
282 client: AuthClientMetadata,
283 issuedAt: Schema.DateTimeUtc,
284 expiresAt: Schema.DateTimeUtc,
285 lastConnectedAt: Schema.NullOr(Schema.DateTimeUtc),
286 connected: Schema.Boolean,
287 current: Schema.Boolean,
288});
289export type AuthClientSession = typeof AuthClientSession.Type;
290​
291export const AuthAccessSnapshot = Schema.Struct({
292 pairingLinks: Schema.Array(AuthPairingLink),
293 clientSessions: Schema.Array(AuthClientSession),
294});
295export type AuthAccessSnapshot = typeof AuthAccessSnapshot.Type;
296​
297export const AuthAccessStreamSnapshotEvent = Schema.Struct({
298 version: Schema.Literal(1),
299 revision: Schema.Number,
300 type: Schema.Literal("snapshot"),
301 payload: AuthAccessSnapshot,
302});
303export type AuthAccessStreamSnapshotEvent = typeof AuthAccessStreamSnapshotEvent.Type;
304​
305export const AuthAccessStreamPairingLinkUpsertedEvent = Schema.Struct({
306 version: Schema.Literal(1),
307 revision: Schema.Number,
308 type: Schema.Literal("pairingLinkUpserted"),
309 payload: AuthPairingLink,
310});
311export type AuthAccessStreamPairingLinkUpsertedEvent =
312 typeof AuthAccessStreamPairingLinkUpsertedEvent.Type;
313​
314export const AuthAccessStreamPairingLinkRemovedEvent = Schema.Struct({
315 version: Schema.Literal(1),
316 revision: Schema.Number,
317 type: Schema.Literal("pairingLinkRemoved"),
318 payload: Schema.Struct({
319 id: TrimmedNonEmptyString,
320 }),
321});
322export type AuthAccessStreamPairingLinkRemovedEvent =
323 typeof AuthAccessStreamPairingLinkRemovedEvent.Type;
324​
325export class AuthAccessStreamError extends Schema.TaggedError<AuthAccessStreamError>()(
326 "AuthAccessStreamError",
327 {
328 message: Schema.String,
329 },
330) {}
331​
332export class EnvironmentAuthorizationError extends Schema.TaggedError<EnvironmentAuthorizationError>()(
333 "EnvironmentAuthorizationError",
334 {
335 message: Schema.String,
336 requiredScope: AuthEnvironmentScope,
337 requiredPermission: Schema.optionalKey(Schema.String),
338 },
339) {}
340​
341export const AuthAccessStreamClientUpsertedEvent = Schema.Struct({
342 version: Schema.Literal(1),
343 revision: Schema.Number,
344 type: Schema.Literal("clientUpserted"),
345 payload: AuthClientSession,
346});
347export type AuthAccessStreamClientUpsertedEvent = typeof AuthAccessStreamClientUpsertedEvent.Type;
348​
349export const AuthAccessStreamClientRemovedEvent = Schema.Struct({
350 version: Schema.Literal(1),
351 revision: Schema.Number,
352 type: Schema.Literal("clientRemoved"),
353 payload: Schema.Struct({
354 sessionId: AuthSessionId,
355 }),
356});
357export type AuthAccessStreamClientRemovedEvent = typeof AuthAccessStreamClientRemovedEvent.Type;
358​
359export const AuthAccessStreamEvent = Schema.Union([
360 AuthAccessStreamSnapshotEvent,
361 AuthAccessStreamPairingLinkUpsertedEvent,
362 AuthAccessStreamPairingLinkRemovedEvent,
363 AuthAccessStreamClientUpsertedEvent,
364 AuthAccessStreamClientRemovedEvent,
365]);
366export type AuthAccessStreamEvent = typeof AuthAccessStreamEvent.Type;
367​
368export const AuthRevokePairingLinkInput = Schema.Struct({
369 id: TrimmedNonEmptyString,
370});
371export type AuthRevokePairingLinkInput = typeof AuthRevokePairingLinkInput.Type;
372​
373export const AuthRevokeClientSessionInput = Schema.Struct({
374 sessionId: AuthSessionId,
375});
376export type AuthRevokeClientSessionInput = typeof AuthRevokeClientSessionInput.Type;
377​
378export const AuthCreatePairingCredentialInput = Schema.Struct({
379 label: Schema.optionalKey(TrimmedNonEmptyString),
380 scopes: Schema.optionalKey(AuthGrantScopes),
381});
382export type AuthCreatePairingCredentialInput = typeof AuthCreatePairingCredentialInput.Type;
383​
384export const AuthSessionState = Schema.Struct({
385 authenticated: Schema.Boolean,
386 auth: ServerAuthDescriptor,
387 scopes: Schema.optionalKey(AuthEnvironmentScopes),
388 permissions: authScopeResponseFields.permissions,
389 sessionMethod: Schema.optionalKey(ServerAuthSessionMethod),
390 expiresAt: Schema.optionalKey(Schema.DateTimeUtc),
391});
392export type AuthSessionState = typeof AuthSessionState.Type;
393​
394export const AuthMcpClientAccess = Schema.Literals([
395 "read-only",
396 "approval-required",
397 "auto-accept-edits",
398 "auto",
399 "full-access",
400]);
401export type AuthMcpClientAccess = typeof AuthMcpClientAccess.Type;
402​
403export const AuthMcpProtectedResourceMetadata = Schema.Struct({
404 resource: Schema.String,
405 authorization_servers: Schema.Array(Schema.String),
406 scopes_supported: Schema.Array(AuthEnvironmentScope),
407 bearer_methods_supported: Schema.Array(Schema.Literal("header")),
408 resource_name: Schema.String,
409});
410export type AuthMcpProtectedResourceMetadata = typeof AuthMcpProtectedResourceMetadata.Type;
411​
412export const AuthMcpAuthorizationServerMetadata = Schema.Struct({
413 issuer: Schema.String,
414 authorization_endpoint: Schema.String,
415 token_endpoint: Schema.String,
416 registration_endpoint: Schema.String,
417 response_types_supported: Schema.Array(Schema.Literal("code")),
418 grant_types_supported: Schema.Array(Schema.Literal("authorization_code")),
419 code_challenge_methods_supported: Schema.Array(Schema.Literal("S256")),
420 token_endpoint_auth_methods_supported: Schema.Array(Schema.Literal("none")),
421 scopes_supported: Schema.Array(AuthEnvironmentScope),
422 authorization_response_iss_parameter_supported: Schema.Boolean,
423});
424export type AuthMcpAuthorizationServerMetadata = typeof AuthMcpAuthorizationServerMetadata.Type;
425​
426export const AuthMcpClientRegistration = Schema.Struct({
427 client_name: Schema.optionalKey(Schema.String),
428 redirect_uris: Schema.optionalKey(Schema.Array(Schema.String)),
429 token_endpoint_auth_method: Schema.optionalKey(Schema.String),
430});
431export type AuthMcpClientRegistration = typeof AuthMcpClientRegistration.Type;
432​
433export const AuthMcpRegisteredClient = Schema.Struct({
434 client_id: Schema.String,
435 client_name: Schema.String,
436 redirect_uris: Schema.Array(Schema.String),
437 grant_types: Schema.Array(Schema.Literal("authorization_code")),
438 response_types: Schema.Array(Schema.Literal("code")),
439 token_endpoint_auth_method: Schema.Literal("none"),
440}).pipe(HttpApiSchema.status(201));
441export type AuthMcpRegisteredClient = typeof AuthMcpRegisteredClient.Type;
442​
443export class AuthMcpRegistrationError extends Schema.Error<AuthMcpRegistrationError>(
444 "AuthMcpRegistrationError",
445)(
446 {
447 error: Schema.Literals(["invalid_client_metadata", "invalid_redirect_uri"]),
448 error_description: Schema.String,
449 },
450 { httpApiStatus: 400 },
451) {
452 override get message(): string {
453 return this.error_description;
454 }
456​
457/**
458 * Every field is checked by the server, so all are optional here.
459 */
460export const AuthMcpAuthorizationRequest = Schema.Struct({
461 response_type: Schema.optionalKey(Schema.String),
462 client_id: Schema.optionalKey(Schema.String),
463 redirect_uri: Schema.optionalKey(Schema.String),
464 code_challenge: Schema.optionalKey(Schema.String),
465 code_challenge_method: Schema.optionalKey(Schema.String),
466 state: Schema.optionalKey(Schema.String),
467 resource: Schema.optionalKey(Schema.String),
468});
469export type AuthMcpAuthorizationRequest = typeof AuthMcpAuthorizationRequest.Type;
470​
471/**
472 * The server has already validated the request; nothing here is trusted by the
473 * client except for display.
474 */
475export const AuthMcpApprovalDetails = Schema.Struct({
476 /** Self-declared by the client, so shown as such. */
477 clientName: Schema.String,
478 redirectHost: Schema.String,
479 environmentHost: Schema.String,
480 csrfToken: Schema.optionalKey(Schema.String),
481 /**
482 * What that session may approve in one click: only access whose scopes it
483 * holds. Anything else still needs a pairing code. Absent with `csrfToken`.
484 */
485 oneClickAccess: Schema.optionalKey(Schema.Array(AuthMcpClientAccess)),
486});
487export type AuthMcpApprovalDetails = typeof AuthMcpApprovalDetails.Type;
488​
489export const AuthMcpApprovalRedirect = Schema.Struct({
490 redirectTo: Schema.String,
491});
492export type AuthMcpApprovalRedirect = typeof AuthMcpApprovalRedirect.Type;
493​
494export const AuthMcpApprovalDecision = Schema.Union([
495 Schema.TaggedStruct("deny", {}),
496 Schema.TaggedStruct("pairing-code", {
497 access: AuthMcpClientAccess,
498 code: TrimmedNonEmptyString,
499 }),
500 Schema.TaggedStruct("browser-session", {
501 access: AuthMcpClientAccess,
502 csrfToken: Schema.String,
503 }),
504]);
505export type AuthMcpApprovalDecision = typeof AuthMcpApprovalDecision.Type;
506​
507export const AuthMcpApprovalDecisionRequest = Schema.Struct({
508 authorization: AuthMcpAuthorizationRequest,
509 decision: AuthMcpApprovalDecision,
510});
511export type AuthMcpApprovalDecisionRequest = typeof AuthMcpApprovalDecisionRequest.Type;
512​
513export class AuthMcpApprovalError extends Schema.TaggedError<AuthMcpApprovalError>()(
514 "AuthMcpApprovalError",
515 { message: Schema.String },
516 { httpApiStatus: 400 },
517) {}
518​
519export const AuthMcpTokenRequest = Schema.Struct({
520 grant_type: Schema.optionalKey(Schema.String),
521 code: Schema.optionalKey(Schema.String),
522 redirect_uri: Schema.optionalKey(Schema.String),
523 client_id: Schema.optionalKey(Schema.String),
524 code_verifier: Schema.optionalKey(Schema.String),
525 resource: Schema.optionalKey(Schema.String),
526}).pipe(HttpApiSchema.asFormUrlEncoded());
527export type AuthMcpTokenRequest = typeof AuthMcpTokenRequest.Type;
528​
529export const AuthMcpTokenResult = Schema.Struct({
530 access_token: Schema.String,
531 token_type: Schema.Literal("Bearer"),
532 expires_in: Schema.Number,
533 scope: Schema.String,
534});
535export type AuthMcpTokenResult = typeof AuthMcpTokenResult.Type;
536​
537export class AuthMcpTokenError extends Schema.Error<AuthMcpTokenError>("AuthMcpTokenError")(
538 {
539 error: Schema.Literals([
540 "invalid_request",
541 "invalid_client",
542 "invalid_grant",
543 "unsupported_grant_type",
544 ]),
545 error_description: Schema.String,
546 },
547 { httpApiStatus: 400 },
548) {
549 override get message(): string {
550 return this.error_description;
551 }