Skip to content

fix(auth): accept an array aud claim in jwt.decode - #19166

Open
shlee1223 wants to merge 1 commit into
googleapis:mainfrom
shlee1223:fix-jwt-audience-list
Open

shlee1223 wants to merge 1 commit into
googleapis:mainfrom
shlee1223:fix-jwt-audience-list

Conversation

@shlee1223

@shlee1223 shlee1223 commented Nov 21, 2026 •

Copy link
Copy Markdown

Hi! jwt.decode rejects a token whose aud claim is an array, which RFC 7519 Section 4.1.3 allows. This accepts the token when any of its audiences is expected.

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

@shlee1223
shlee1223 requested review from a team as code owners November 21, 2026 13:54
@google-cla

google-cla Bot commented Nov 21, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the JWT decoding logic in google/auth/jwt.py to support cases where the audience (aud) claim in the token payload is a list of strings rather than a single string. It also adds corresponding unit tests in tests/test_jwt.py to verify both successful decoding with a matching audience list and failure when none of the audiences match. No review comments were provided, and the changes look correct and well-tested.

This branch has not been deployed

No deployments
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.

1 participant