@@ -2725,8 +2725,6 @@ export async function processPushedAuthorizationResponse(
27252725 throw CodedTypeError ( '"response" must be an instance of Response' , ERR_INVALID_ARG_TYPE )
27262726 }
27272727
2728- checkAuthenticationChallenges ( response )
2729-
27302728 await checkOAuthBodyError ( response , 201 , 'Pushed Authorization Request Endpoint' )
27312729
27322730 assertReadableResponse ( response )
@@ -2775,6 +2773,8 @@ async function parseOAuthResponseErrorBody(response: Response): Promise<OAuth2Er
27752773
27762774async function checkOAuthBodyError ( response : Response , expected : number , label : string ) {
27772775 if ( response . status !== expected ) {
2776+ checkAuthenticationChallenges ( response )
2777+
27782778 let err : OAuth2Error | undefined
27792779 if ( ( err = await parseOAuthResponseErrorBody ( response ) ) ) {
27802780 await response . body ?. cancel ( )
@@ -3452,8 +3452,6 @@ async function processGenericAccessTokenResponse(
34523452 throw CodedTypeError ( '"response" must be an instance of Response' , ERR_INVALID_ARG_TYPE )
34533453 }
34543454
3455- checkAuthenticationChallenges ( response )
3456-
34573455 await checkOAuthBodyError ( response , 200 , 'Token Endpoint' )
34583456
34593457 assertReadableResponse ( response )
@@ -4373,8 +4371,6 @@ export async function processRevocationResponse(response: Response): Promise<und
43734371 throw CodedTypeError ( '"response" must be an instance of Response' , ERR_INVALID_ARG_TYPE )
43744372 }
43754373
4376- checkAuthenticationChallenges ( response )
4377-
43784374 await checkOAuthBodyError ( response , 200 , 'Revocation Endpoint' )
43794375
43804376 return undefined
@@ -4508,8 +4504,6 @@ export async function processIntrospectionResponse(
45084504 throw CodedTypeError ( '"response" must be an instance of Response' , ERR_INVALID_ARG_TYPE )
45094505 }
45104506
4511- checkAuthenticationChallenges ( response )
4512-
45134507 await checkOAuthBodyError ( response , 200 , 'Introspection Endpoint' )
45144508
45154509 let json : JsonObject
@@ -5592,8 +5586,6 @@ export async function processDeviceAuthorizationResponse(
55925586 throw CodedTypeError ( '"response" must be an instance of Response' , ERR_INVALID_ARG_TYPE )
55935587 }
55945588
5595- checkAuthenticationChallenges ( response )
5596-
55975589 await checkOAuthBodyError ( response , 200 , 'Device Authorization Endpoint' )
55985590
55995591 assertReadableResponse ( response )
@@ -6172,8 +6164,6 @@ export async function processBackchannelAuthenticationResponse(
61726164 throw CodedTypeError ( '"response" must be an instance of Response' , ERR_INVALID_ARG_TYPE )
61736165 }
61746166
6175- checkAuthenticationChallenges ( response )
6176-
61776167 await checkOAuthBodyError ( response , 200 , 'Backchannel Authentication Endpoint' )
61786168
61796169 assertReadableResponse ( response )
@@ -6367,8 +6357,6 @@ export async function processDynamicClientRegistrationResponse(
63676357 throw CodedTypeError ( '"response" must be an instance of Response' , ERR_INVALID_ARG_TYPE )
63686358 }
63696359
6370- checkAuthenticationChallenges ( response )
6371-
63726360 await checkOAuthBodyError ( response , 201 , 'Dynamic Client Registration Endpoint' )
63736361
63746362 assertReadableResponse ( response )
0 commit comments