Using python, Decode client side token fetched by microsoft teams and given to tab inside teams

523 views Asked by At

I am trying to learn tab SSO. When Microsoft teams fetch token from AAD and pass it to tab, I want to send that token to my application server using ajax and decode it at server end.

I can see client side token successfully decoded by manually copy pasting in jwt.ms

Is there any python code that can be used to do the same done by jwt.ms? I tried this but getting the following error:

jwt.exceptions.InvalidAudienceError: Invalid audience
2

There are 2 answers

1
Carl Zhao On BEST ANSWER

Your issue has been resolved. This is an error caused by an invalid audience you are using. You must change it to the correct audience: api://<webapp-domain>/<client_id>.

This audience is actually the protected api that you expose in Azure.

0
Abhishek Singh On

Setting this solved my problem:

protectedResourceMap.set(`${my_api}`, [`${client_id}/.default`]);