微软语音识别 api

Microsoft speech recognition api

我想问一下这个API
的身份验证 响应的 "The token" 是否有过期时间之类的?还是永恒?

文档 link 在这里: https://www.microsoft.com/cognitive-services/en-us/Speech-api/documentation/API-Reference-REST/BingVoiceRecognition#Authorize

令牌是 JSON Web Token (JWT), which—unless it's encrypted—can be decoded to inspect its contents (a web service to perform that task can be found here).

在生成的 JSON 文档中使用 exp 属性 设置过期声明。

有效期为 10 分钟。它在文档中指定:https://www.microsoft.com/cognitive-services/en-us/speech-api/documentation/API-Reference-REST/BingVoiceRecognition

Bing 演讲团队

如果你不想每次都登录而不是使用 'Authorization': 'Bearer {TOKEN}' header 你可以使用 'Ocp-Apim-Subscription-Key': '{YOUR AZURE TOKEN}' 来不必创建授权工厂或更多向应用程序提出不必要的请求并使其更快

注意:{TOKEN} 是一个 JWT 令牌,类似于

eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzY29wZSI6Imh0dHBzOi8vc3BlZWNoLnBsYXRmb3JtLmJpbmcuY29tIiwic3Vic2NyaXB0aW9uLWlkIjoiZmFhZTNlYTkxNmI1NGMxZWEyODY4MDlhYTg3ZWE1MmUiLCJwcm9kdWN0LWlkIjoiQmluZy5TcGVlY2guUHJldmlldyIsImNvZ25pdGl2ZS1zZXJ2aWNlcy1lbmRwb2ludCI6Imh0dHBzOi8vYXBpLmNvZ25pdGl2ZS5taWNyb3NvZnQuY29tL2ludGVybmFsL3YxLjAvIiwiYXp1cmUtcmVzb3VyY2UtaWQiOiIiLCJpc3MiOiJ1cm46bXMuY29nbml0aXZlc2VydmljZXMiLCJhdWQiOiJ1cm46bXMuc3BlZWNoIiwiZXhwIjoxNTAwODgxNjIzfQ.KdlCrIJ_H0jxs1yyeyYxYR7ucbLuFKT__ep7lGJmGbU

注意 2:{YOUR AZURE TOKEN} 类似于 d5kals90935b40809dc6k38533c21e85,您找到它 here

请求将如下所示:

curl -v -X POST "https://speech.platform.bing.com/speech/recognition/interactive/cognitiveservices/v1?language=es-ES&locale=es-ES&format=simple&requestid=req_id" -H "Ocp-Apim-Subscription-Key: d5kals90935b40809dc6k38533c21e85" -H 'Transfer-Encoding: chunked'  -H 'Content-type: audio/wav; codec="audio/pcm"; samplerate=8000' --data-binary @"{BINAYFILE}.wav"