Skip to content

JWT aud validation raises "Invalid audience" for audience=None #389

Description

@temple

Description

With python-Jose 3.5.0 run on Python 3.12.3

When calling _validate_aud at jose/jwt.py passing the following arguments:

  • claims param receiving an instance of Mapping[str,Any] with a key aud containing a str typed value
  • audience param receiving the value None

An exception of class JWTClaimsError containing the message 'Invalid audience' is raised.

Additional info

When _validate_aud is called with previous parameters, none of the conditions raising exceptions are satisfied except the latest one, appearing in jwt.py on line 366 at commit 393c37476c728782dacc41cd79472627a5b198f3

    if audience not in audience_claims:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions