Translator Java SDK fails with "{"error":{"code":401001,"message":"The request is not authorized because credentials are missing or invalid."}}"
Jason Bodnar
0
Reputation points
Using the Java SDK, I keep getting "{"error":{"code":401001,"message":"The request is not authorized because credentials are missing or invalid."}}"
. I've tried adding the tenantId, the endpoint URL, the resourceId, etc. I'm logged into the appropriate subscription using the Azure cli.
@Bean
public TextTranslationClient textTranslationClient() {
return new TextTranslationClientBuilder()
.credential(new DefaultAzureCredentialBuilder()
.build())
.buildClient();
}
TranslatedTextItem translatedTextItem = textTranslationClient.translate(text, new TranslateOptions().setTargetLanguages(SUPPORTED_LANGUAGES));
Sign in to answer