Skip to content

Commit 5ca1eda

Browse files
committed
set both variables to be compliant
Signed-off-by: Mirko Mollik <mirkomollik@gmail.com>
1 parent 7e06eb3 commit 5ca1eda

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

packages/client/lib/AccessTokenClient.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ export class AccessTokenClient {
104104

105105
if (credentialOfferRequest?.supportedFlows.includes(AuthzFlowType.PRE_AUTHORIZED_CODE_FLOW)) {
106106
this.assertAlphanumericPin(opts.pinMetadata, pin);
107+
request.user_pin = pin;
107108
request.tx_code = pin;
108109

109110
request.grant_type = GrantTypes.PRE_AUTHORIZED_CODE;

packages/issuer/lib/tokens/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,17 @@ export const assertValidAccessTokenRequest = async (
102102
invalid_request:
103103
the Authorization Server does not expect a PIN in the pre-authorized flow but the client provides a PIN
104104
*/
105-
if (!credentialOfferSession.credentialOffer.credential_offer?.grants?.[GrantTypes.PRE_AUTHORIZED_CODE]?.tx_code && request.tx_code) {
105+
if (
106+
!credentialOfferSession.credentialOffer.credential_offer?.grants?.[GrantTypes.PRE_AUTHORIZED_CODE]?.tx_code &&
107+
request.tx_code &&
108+
!request.user_pin
109+
) {
106110
// >= v13
107111
throw new TokenError(400, TokenErrorResponse.invalid_request, USER_PIN_NOT_REQUIRED_ERROR)
108112
} else if (
109113
!credentialOfferSession.credentialOffer.credential_offer?.grants?.[GrantTypes.PRE_AUTHORIZED_CODE]?.user_pin_required &&
110-
request.user_pin
114+
request.user_pin &&
115+
!request.tx_code
111116
) {
112117
// <= v12
113118
throw new TokenError(400, TokenErrorResponse.invalid_request, USER_PIN_NOT_REQUIRED_ERROR)

0 commit comments

Comments
 (0)