Skip to content

Commit

Permalink
fix: for pin in IssuerTokenServer
Browse files Browse the repository at this point in the history
  • Loading branch information
sksadjad committed May 17, 2024
1 parent b8bb359 commit 354e8ad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/issuer-rest/lib/__tests__/IssuerTokenServer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ describe('OID4VCIServer', () => {
expect(res.statusCode).toEqual(400)
const actual = JSON.parse(res.text)
expect(actual).toEqual({
error: 'invalid_request',
error_description: 'User pin is required',
error: 'invalid_grant',
error_description: 'PIN is invalid',
})
})
it('should return http code 400 with message pre-authorized_code is required', async () => {
Expand Down
4 changes: 1 addition & 3 deletions packages/issuer/lib/tokens/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ export const assertValidAccessTokenRequest = async (
the Authorization Server expects a PIN in the pre-authorized flow but the client does not provide a PIN
*/
if (
credentialOfferSession.credentialOffer.credential_offer?.grants?.['urn:ietf:params:oauth:grant-type:pre-authorized_code']?.[
'pre-authorized_code'
] &&
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)
Expand Down

0 comments on commit 354e8ad

Please sign in to comment.