【发布时间】:2021-07-03 10:19:03
【问题描述】:
我想使用带有授权令牌的 azure 翻译服务。有很多资源解释如何使用订阅密钥进行操作,但我找不到任何解释授权令牌使用的资源。我可以获得授权令牌,但是当我使用它发送请求时,响应状态码是 401。 这就是我发送请求的方式:
curl POST 'https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=es' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer token' \
--data-raw '[{'\''Text'\'':'\''Hello World!'\''}]'
【问题讨论】:
-
请避免将代码共享为图像。而是粘贴格式正确的代码。谢谢。
-
我不这么认为,正如文档docs.microsoft.com/en-us/azure/cognitive-services/translator/…中描述的那样
-
那种看起来不错(在我的 curl 版本中,你必须说
-X POST而不仅仅是POST)。你应该检查你的令牌。 -
亲爱的,我不认为问题出在因为我也尝试使用他们的 SDK (github.com/MicrosoftTranslator/Text-Translation-API-V3-NodeJS/…) 并且发生了同样的事情。
标签: azure microsoft-cognitive azure-cognitive-services microsoft-translator