We are obtaining the IAP JWT token for the services on our hosts, usign the bash script, running on timer. The Bash script is heavily based on the script, published in this document
In particular, the way we create the payload is exactly the same, like in this script.
Not long ago we started to have an increasing number of 401 responces to the requests which were supposed to be valid, resulting, in the apex, to a significant data loss, which forced us to disable the IAP for our endpoint. After investigating the issue, we found that the problem seemingly was in the invalid symbols “+” and “/”, which contaminated the base64 encoded payload. At least after we added | tr “+/” “-_” to the commands, creating the base64 encoded payload, the errors with obtaining the token stopped.
What we want to know is: why that script was working correctly for years, but suddenly started to fail. We were not warned about any changes in the AIP API, we found no mentions about it in the documentation or blog posts.