In our dev environment, we are receiving the following exception when trying to request the token from the Auth API based on the audience. This code has been working fine for awhile, but just started failing within the last few weeks only in our dev environment. The code works fine in all our other environments, so I suspect this is something specific to our dev environment setup.

The requestToken method performs a client credentials grant so if you consider that in conjunction with the fact that you say that this only happens in one of your environment the most likely cause is that you have a client credentials hook configured in that environment that is causing an error and leading to the overall grant to fail.

The theory above is made stronger due to the type of the error, in particular, the mention of a Script which suggests that a custom extensibility point that allows to provide custom scripts is being used.