I am trying to use Azure Text Translation Service, but it give me 401 unauthorized when I try to use barerr token

Muhammad Hassan 0 Reputation points

I am trying to use Azure AI Text Translation. With the Ocp-Apim-Subscription-Key method, it's working fine.

However, when I try to use the barrier token, it gives me 401 unauthorized. I have already added my web App as managed Identity in Translator service to give permission to my web app on translation service..

my document translation is working fine, my web app can access and translate documents. But my text translation is not working.

My question is, does the text translation service have limited authentication types?

End point: https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=de

I also tried postman also, to send a barrier token, but it's not working.

my C# code that is deployed in web app is using below method:

var credentials = new DefaultAzureCredential();

var tokenResult = await credentials.GetTokenAsync(new TokenRequestContext(new[] { _translationConfigOptions.TranslatorEndpoint }), CancellationToken.None);

And token is sent to Azure translation service. that throws 401.

Azure Translator
Azure Translator
An Azure service to easily conduct machine translation with a simple REST API call.
364 questions
{count} votes