What does the reason AMBIGUOUS_CREDENTIALS mean?
A request to /v1 carried a session cookie and a bearer token together.
The message is "Send either a session cookie or a bearer token, not both".
Send one of the two. A script should send no cookies.