You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "", line 1, in
File "/venv/lib/python3.5/site-packages/keycloak/keycloak_openid.py", line 346, in decode_token
audience=self.client_id, **kwargs)
File "/venv/lib/python3.5/site-packages/jose/jwt.py", line 172, in decode
options=defaults)
File "/venv/lib/python3.5/site-packages/jose/jwt.py", line 495, in _validate_claims
_validate_aud(claims, audience=audience)
File "/venv/lib/python3.5/site-packages/jose/jwt.py", line 357, in _validate_aud
raise JWTClaimsError('Invalid audience')
jose.exceptions.JWTClaimsError: Invalid audience
`
setting verify_aud false was sufficient for my case
Reacted by Steen Manniche, Angela Crepaldi, Tatiana Hanazaki, José Danilo Silva, Radu Serdin, Felipe Mattioni Maturana, Ph.D., raagnaidu-cel, Triet Doan, Nic, michelafazzolari and 14 more
Reacted by Raf (Raffaele Rialdi)
Reacted by Ivaldir Batalha
Reacted by Jonhatan Fajardo, Pamphile Roy, Harsh Vardhan, desinox and OlyaTsyb
I added a token mapper (with type Audience) to the dedicated scope of my client. Clients > Your client > Client scopes > your-client-dedicated > Add mapper > by configuration > Audience.
Add a name of the mapper, select your client on the select box and enable "Add to access token".
Your client should now be in the "aud" field of the access token
Reacted by valentin, Adam Huganir, Yurii Motov, Emilio Moreno, Nick Boultbee and A. Rodriguez
Reacted by Deivison de Alcantara santos, Emilio Moreno and Brandon Mitchell
I added a token mapper (with type Audience) to the dedicated scope of my client. Clients > Your client > Client scopes > your-client-dedicated > Add mapper > by configuration > Audience. Add a name of the mapper, select your client on the select box and enable "Add to access token". Your client should now be in the "aud" field of the access token
Activity
simonrankine commentedon Jul 20, 2020
I hit this - it looks like there has been a change to KeyCloak recently, and it doesn't map the client ID into the auth field of the token by default any more. The solution for me was to add a mapper that maps the client ID into the audience claim (more here: https://stackoverflow.com/questions/53550321/keycloak-gatekeeper-aud-claim-and-client-id-do-not-match)
MohiuddinSumon commentedon Aug 16, 2020
I also faced similar issue today, I passed the audience with decode call
lucj commentedon Jan 14, 2021
@MohiuddinSumon would you have an example on own to provide the audience in the decode call ?
MohiuddinSumon commentedon Jan 17, 2021
@lucj what I finally ended up doing was something like this:
setting verify_aud false was sufficient for my case
lucj commentedon Jan 20, 2021
Thanks @MohiuddinSumon I'm using the same.
woprandi commentedon Feb 23, 2023
same issue with latest keycloak
0xf938Ac9BA commentedon Apr 5, 2023
Have you managed to solve it?
woprandi commentedon Apr 5, 2023
Yes few weeks ago :
I added a token mapper (with type Audience) to the dedicated scope of my client.
Clients > Your client > Client scopes > your-client-dedicated > Add mapper > by configuration > Audience.Add a name of the mapper, select your client on the select box and enable "Add to access token".
Your client should now be in the "aud" field of the access token
0xf938Ac9BA commentedon Apr 7, 2023
Thank you!
hmendezm commentedon Sep 3, 2024
Hi guys, I am new with mappers... Can someone share a example in how to create a mapper for keycloak as metioning above?
Thanks
H. Mendez
woprandi commentedon Sep 4, 2024
@hmendezm I explained 2 posts above
brayohmurithidev commentedon Nov 29, 2024
This helped me. Thank you