Hi, thanks for reaching out. The error is most likely due to invalid endpoint for your region/service or issues with your subscription key. Please go to Azure portal > speech resource > resource management > Keys and Endpoint to confirm your authentication details.
speech to text Authentication error (401) on GitHub SDK samples c++ console
I am testing an azure cognitive services speech. Pricing tier is free (f0). I followed instructions for creating instance and service. It is listed as Cognitive services, API type: speech
I am getting error code= 1 : ErrorDetails=WebSocket upgrade failed: Authentication error (401). Please check subscription information
This is pointing to either subscriptionkey or service region. I am using a C++ console sdk sample from https://github.com/Azure-Samples/cognitive-services-speech-sdk/tree/master/samples/cpp/windows/console
I am targeting the SpeechContinuousRecognitionWithFile() from SpeechRecognitionSamples ( option 1 then option 3). I only replaced key and region on this method.
I tried with two different regions in different instances: northeurope and westus. I tried three different keys. None worked.
I verified the subscription using this on powershell
$FetchTokenHeader = @{
'Content-type'='application/x-www-form-urlencoded';
'Content-Length'= '0';
'Ocp-Apim-Subscription-Key' = 'YOUR_SUBSCRIPTION_KEY'
}
$OAuthToken = Invoke-RestMethod -Method POST -Uri https://westus.api.cognitive.microsoft.com/sts/v1.0/issueToken
-Headers $FetchTokenHeader
show the token received
$OAuthToken
Any idea on what to check is very much appreciated.