REST API Authentication Error: Azure AI

Tominaga, Kohei/富永 航平 25 Reputation points
2023-11-01T06:48:19.26+00:00

Hello,

I am a beginner about Azure AI.
I am trying to use Text Analytics in Azure by calling POST request but it failed with an error.
Could you please help me to do troubleshooting?

Request header:
{Content-Length=2047, Authorization=Bearer xxxxxxxxxxxxxxxxxxxxxxxxx, Content-Type=application/json, X-SNC-INTEGRATION-SOURCE=66cce6f7db88bb402f68c59705961974, User-Agent=ServiceNow/1.0, Host=xxxxxxxxxxxxxxxxx.cognitiveservices.azure.com}
Request body:

{
  "displayName": "Document Abstractive Summarization Task Example",
  "analysisInput": {
    "d**body truncated**

I am using the sample body written in the reference.

Response header:
{Content-Length=161, Content-Type=application/json, apim-request-id=d3208fa5-3554-4387-8a44-1974de3a85cf, Strict-Transport-Security=max-age=31536000; includeSubDomains; preload, x-content-type-options=nosniff, Date=Wed, 01 Nov 2023 06:28:19 GMT}
Response body:
{ "statusCode": 401, "message": "Unauthorized. Access token is missing, invalid, audience is incorrebody truncated

Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
1,862 questions
{count} votes