I am trying to call bing text to speech azure services but i keep getting this error on getting the access token , although the subscription key is provided
function requestAudio(text,lang)
{
nameLanguage = "Microsoft Server Speech Text to Speech Voice (en-GB, Susan, Apollo)";
language = lang;
textToSpeak = text;
$.ajax(
{
type: 'POST',
url: tokenURL,
data:
{
'Ocp-Apim-Subscription-Key': 'xxxxxxf8cc34d08b646de1bc54c950d'
}
}).done(function(data)
{
token = data.access_token;
sendAudioRequest();
});
}
The error exactly from fiddler is
{ "statusCode": 401, "message": "Access denied due to missing subscription key. Make sure to include subscription key when making requests to an API." }
and the url i am calling is
.0/issueToken
I am trying to call bing text to speech azure services but i keep getting this error on getting the access token , although the subscription key is provided
function requestAudio(text,lang)
{
nameLanguage = "Microsoft Server Speech Text to Speech Voice (en-GB, Susan, Apollo)";
language = lang;
textToSpeak = text;
$.ajax(
{
type: 'POST',
url: tokenURL,
data:
{
'Ocp-Apim-Subscription-Key': 'xxxxxxf8cc34d08b646de1bc54c950d'
}
}).done(function(data)
{
token = data.access_token;
sendAudioRequest();
});
}
The error exactly from fiddler is
{ "statusCode": 401, "message": "Access denied due to missing subscription key. Make sure to include subscription key when making requests to an API." }
and the url i am calling is
https://api.cognitive.microsoft./sts/v1.0/issueToken
Share
Improve this question
edited Oct 4, 2017 at 1:41
abatishchev
100k88 gold badges301 silver badges442 bronze badges
asked Feb 26, 2017 at 11:29
Mazen Abu TaweelihMazen Abu Taweelih
6471 gold badge9 silver badges24 bronze badges
1
- Related posts - API management URL is giving Missing subscription key Issue] & Azure Api management Is it possible to disable Subscription Key – RBT Commented Sep 30, 2021 at 14:23
1 Answer
Reset to default 5I'm pretty sure you have to set those in the header, not in the body.
beforeSend: function(request) {
request.setRequestHeader("Ocp-Apim-Subscription-Key", 'xxxxxxf8cc34d08b646de1bc54c950d');
},
Reference: https://msdn.microsoft./en-us/library/mt712546.aspx
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744965755a4603669.html
评论列表(0条)