Auth tests and fixes

This commit is contained in:
Justin Spahr-Summers 2025-02-11 13:47:58 +00:00
commit d17a382a65
No known key found for this signature in database

View file

@ -120,7 +120,7 @@ export async function startAuthorization(
if (metadata) {
authorizationUrl = new URL(metadata.authorization_endpoint);
if (!(responseType in metadata.response_types_supported)) {
if (!metadata.response_types_supported.includes(responseType)) {
throw new Error(
`Incompatible auth server: does not support response type ${responseType}`,
);
@ -128,7 +128,7 @@ export async function startAuthorization(
if (
!metadata.code_challenge_methods_supported ||
!(codeChallengeMethod in metadata.code_challenge_methods_supported)
!metadata.code_challenge_methods_supported.includes(codeChallengeMethod)
) {
throw new Error(
`Incompatible auth server: does not support code challenge method ${codeChallengeMethod}`,
@ -177,7 +177,7 @@ export async function exchangeAuthorization(
if (
metadata.grant_types_supported &&
!(grantType in metadata.grant_types_supported)
!metadata.grant_types_supported.includes(grantType)
) {
throw new Error(
`Incompatible auth server: does not support grant type ${grantType}`,
@ -228,7 +228,7 @@ export async function refreshAuthorization(
if (
metadata.grant_types_supported &&
!(grantType in metadata.grant_types_supported)
!metadata.grant_types_supported.includes(grantType)
) {
throw new Error(
`Incompatible auth server: does not support grant type ${grantType}`,
@ -301,4 +301,4 @@ export async function registerClient(
}
return ClientInformationSchema.parse(await response.json());
}
}