Skip to content

Commit

Permalink
fix: undo tx_code changes
Browse files Browse the repository at this point in the history
  • Loading branch information
auer-martin committed Jul 5, 2024
1 parent 81bf769 commit 7888a14
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/issuer/lib/tokens/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,19 @@ export const assertValidAccessTokenRequest = async (
invalid_request:
the Authorization Server expects a PIN in the pre-authorized flow but the client does not provide a PIN
*/
const preAuthorizedGrant = credentialOfferSession.credentialOffer.credential_offer?.grants?.[GrantTypes.PRE_AUTHORIZED_CODE]
if ((preAuthorizedGrant?.tx_code || preAuthorizedGrant?.user_pin_required) && !request.user_pin) {
if (
credentialOfferSession.credentialOffer.credential_offer?.grants?.['urn:ietf:params:oauth:grant-type:pre-authorized_code']?.tx_code &&
!request.user_pin
) {
throw new TokenError(400, TokenErrorResponse.invalid_request, USER_PIN_REQUIRED_ERROR)
}
/*
invalid_request:
the Authorization Server does not expect a PIN in the pre-authorized flow but the client provides a PIN
*/
if (!preAuthorizedGrant?.user_pin_required && !preAuthorizedGrant?.tx_code && request.user_pin) {
if (!credentialOfferSession.credentialOffer.credential_offer?.grants?.[GrantTypes.PRE_AUTHORIZED_CODE]?.user_pin_required && request.user_pin) {
throw new TokenError(400, TokenErrorResponse.invalid_request, USER_PIN_NOT_REQUIRED_ERROR)
}

/*
invalid_grant:
the Authorization Server expects a PIN in the pre-authorized flow but the client provides the wrong PIN
Expand Down

0 comments on commit 7888a14

Please sign in to comment.