GitHub OIDC: token is correct, but audience mismatch
Calling the service after receiving the OIDC token ends with 401 with an Audience or Issuer error. The Exhibitor may sign the token correctly, but the aud does not correspond to the value expected by the service.
How to determine the source of the error
Read it without revealing token values iss, aud and workflow ref from payload JWT in a safe environment.
Check the audience configuration when downloading the token and the value required by the verification server.
What to do step by step
1. Request a token with the correct audit value and check the service side also signature, issuer, exp, repo and ref.
2 . Limit the id-token permission: write to the job needed and the trusted branch.
How to check the score
A trusted workflow passes, and token with a foreign repo or incorrect audience is rejected.
What to do
Do not accept any JWT only on the basis of a readable payoad without checking your signature.