Skip to content

fix: support multiple audiences in ID token validation#382

Open
dileepapeiris wants to merge 4 commits intoasgardeo:mainfrom
dileepapeiris:fix-multiple-audience-validations
Open

fix: support multiple audiences in ID token validation#382
dileepapeiris wants to merge 4 commits intoasgardeo:mainfrom
dileepapeiris:fix-multiple-audience-validations

Conversation

@dileepapeiris
Copy link

@dileepapeiris dileepapeiris commented Mar 3, 2026

Purpose

Fixes ID token validation failure when tokens contain multiple audiences.

Problem:

  • Some tokens have multiple audiences in the aud claim (e.g., ["client-id", "additional-audience"])
  • SDK was passing audience: clientId (string) to jose.jwtVerify()
  • Validation failed because jose couldn't match a string against an array
  • Users were logged out during token validation, before the token's natural expiration time

Solution:
Changed the audience parameter from string to array in all crypto-utils files:

  • Before: audience: clientId
  • After: audience: [clientId]

This allows jose to properly validate tokens with single or multiple audiences.

Related Issues

Related PRs

  • N/A

Checklist

  • Followed the CONTRIBUTING guidelines.
  • Manual test round performed and verified.
  • Unit tests provided. (Existing tests cover this - no new tests needed)

Security checks

Change audience parameter from string to array in jose.jwtVerify() to properly validate tokens with multiple audiences (e.g., Choreo tokens with ['client-id', 'choreo:deployment:sandbox']). This fixes validation failures that caused immediate logout after authentication."
Change audience parameter from string to array in jose.jwtVerify() to properly validate tokens with multiple audiences (e.g., Choreo tokens with ['client-id', 'choreo:deployment:sandbox']). This fixes validation failures that caused immediate logout after authentication."
Change audience parameter from string to array in jose.jwtVerify() to properly validate tokens with multiple audiences (e.g., Choreo tokens with ['client-id', 'choreo:deployment:sandbox']). This fixes validation failures that caused immediate logout after authentication."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ID token validation fails with tokens containing multiple audiences

1 participant