REST API Authentication Error: Azure AI

2023-11-01T06:54:12.3+00:00

Hello

I am a beginner about Azure services and learning with free subscription.
I am trying to use Text Analytics by calling REST API but it failed with an error.

Could you please help me to do troubleshooting?

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

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

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

Foundry Tools
Foundry Tools

Formerly known as Azure AI Services or Azure Cognitive Services is a unified collection of prebuilt AI capabilities within the Microsoft Foundry platform

0 comments No comments

2 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    3 deleted comments

    Comments have been turned off. Learn more

  2. Azar 31,725 Reputation points MVP Volunteer Moderator
    2023-11-01T10:00:34.22+00:00

    HI Tominaga

    Seems like you are having error with the api endpoints, Ensure that the API key you're using in the "Authorization" header is correct and hasn't expired this might be the problem. You can obtain the API key from the Azure portal by going to your Text Analytics resource and looking for the "Keys and Endpoint" section. in that section you will find 2 keys use any one of them and hopefully it works this time.

    If this helps kindly upvote and accept the answer for assistance ping here thanks much.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.