From 4e15dbd9aaef56b78ac8f885220d94f785d2b30c Mon Sep 17 00:00:00 2001 From: Maxim Date: Tue, 3 Jan 2023 16:22:42 +0300 Subject: Differentiate between two errors (#809) * Differentiate between two errors * #809 mention in the changelog --- CHANGELOG.rst | 2 ++ jwt/api_jwt.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 37875e9..3c69338 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -10,6 +10,8 @@ This project adheres to `Semantic Versioning `__. Changed ~~~~~~~ +- Changed the error message when the token audience doesn't match the expected audience by @irdkwmnsb `#809 `__ + Fixed ~~~~~ diff --git a/jwt/api_jwt.py b/jwt/api_jwt.py index 8840708..fd8a8bf 100644 --- a/jwt/api_jwt.py +++ b/jwt/api_jwt.py @@ -331,7 +331,7 @@ class PyJWT: audience = [audience] if all(aud not in audience_claims for aud in audience): - raise InvalidAudienceError("Invalid audience") + raise InvalidAudienceError("Audience doesn't match") def _validate_iss(self, payload: dict[str, Any], issuer: Any) -> None: if issuer is None: -- cgit v1.2.1