admin管理员组文章数量:1406060
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
版权声明:本文标题:javascript - azure issue token api returning Access denied due to missing subscription key - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744965754a2634937.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论