Skip to content

Commit 9f3448f

Browse files
committed
fix: accept null introspection_endpoint in OAuthMetadataSchema
Some OAuth authorization servers (e.g. Dotdigital's MCP server) return introspection_endpoint: null in their .well-known/oauth-authorization-server metadata rather than omitting the field entirely. The current schema uses z.string().optional() which accepts undefined but rejects null, causing OAuth flow initiation to fail with: "Invalid input: expected string, received null" Changing to z.string().nullish() accepts both undefined and null, which aligns with RFC 7662 where introspection_endpoint is optional and a server returning null should be treated the same as not including it.
1 parent b8886e7 commit 9f3448f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/core/src/shared/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const OAuthMetadataSchema = z.looseObject({
6262
revocation_endpoint: SafeUrlSchema.optional(),
6363
revocation_endpoint_auth_methods_supported: z.array(z.string()).optional(),
6464
revocation_endpoint_auth_signing_alg_values_supported: z.array(z.string()).optional(),
65-
introspection_endpoint: z.string().optional(),
65+
introspection_endpoint: z.string().nullish(),
6666
introspection_endpoint_auth_methods_supported: z.array(z.string()).optional(),
6767
introspection_endpoint_auth_signing_alg_values_supported: z.array(z.string()).optional(),
6868
code_challenge_methods_supported: z.array(z.string()).optional(),

0 commit comments

Comments
 (0)