Error: the received token has the wrong type of token. What should the marker look like?

I recently signed up for Microsoft Azure and created a Cognitive Services account. Using the instructions from the Text Translation API Documentation , I was able to get the authentication token from the / issueToken service using an interactive online example . However, if I want to use this token (for example, for an interactive / translation example ), I get a response

<html><body><h1>Argument Exception</h1><p>Method: Translate()</p><p>Parameter: </p><p>Message: The received token is of incorrect token type.</p><code></code><p>message id=0344.V2_Rest.Translate.3D8A6FF1</p></body></html>

What am I doing wrong? What should the token look like and in what format should I provide it? In the online example, I specified the token by setting the appid field to "Bearer [token]", where [token] is the response from / issueToken.

In my case, the token is a string with a length of 687 characters, which can be divided into three parts (using "." As a separator). The first two parts are base64 encoded and contain only some JSON-encoded information that remains constant (except for the expiration date field). The third and last part changes every time and cannot be decoded using base64. Instead of supplying a full token, I also tried to use various substrings of the full token, but without any success.

I also tried authentication through curl, using the Authentication header instead of the appid field, which also didn't work for me.

+4
source share
1 answer

, ( , ). , . : API API ; .

, , , , , .

+3

Source: https://habr.com/ru/post/1661858/


All Articles