jhudsl / mscstts

R Client for the Microsoft Cognitive Services Text to Speech REST API
GNU General Public License v3.0
8 stars 6 forks source link

Api key not Accepting. Getting HTTP 401 error. #3

Closed mallick84 closed 5 years ago

mallick84 commented 5 years ago

Hi, I am trying to use your package for the first time. In fact I am new to R.

I have set up my cognitive text to speech API.

Location: East Asia.

EndPoint: https://eastasia.api.cognitive.microsoft.com/sts/v1.0/issuetoken

Key1: 9afxxxxxxxxxxxx kwy:2: 8exxxxxxxxxxxx

API type: speech

Pricing Tier: Free.

I have install

remotes::install_github("muschellij2/mscstts")

As per your tutorial I have done the following steps

library(checkpoint)
checkpoint("2018-12-19")
library(fortunes)
library(mscstts)
> checkpoint("2018-12-19") Scanning for packages used in this project - Discovered 4 packages All detected packages already installed checkpoint process complete ---
--
set_ms_tts_key("9afxxxxxxx")

out <- ms_synthesize("hello, world!", output_format = "audio-16khz-128kbitrate-mono-mp3")
f <- tempfile(fileext=".mp3") 
writeBin(out$content, f)
shell(paste("start ", f)) 

I am getting following error

> set_ms_tts_key("9afxxxxxxxxxxxxx") > out <- ms_synthesize("hello, world!", output_format = "audio-16khz-128kbitrate-mono-mp3") Error in get_ms_tts_token(api_key = api_key) : Unauthorized (HTTP 401).
--

  I have also tried other way but still getting same error

res<-ms_synthesize("hey, how are you doing? I'm doing pretty good",
+                       api_key = '9axxxxxxxxxx',
+                       token = "eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ1cm46bXMuY29nbml0aXZlc2VydmljZXMiLCJleHAiOiIxNTQ1MzA4OTE0IiwicmVnaW9uIjoiZWFzdGFzaWEiLCJzdWJzY3JpcHRpb24taWQiOiJjYzllZTFkOTg3ZTU0Zjk1YmEzYTQxOWE4NzYxZTgzYiIsInByb2R1Y3QtaWQiOiJTcGVlY2hTZXJ2aWNlcy5GMCIsImNvZ25pdGl2ZS1zZXJ2aWNlcy1lbmRwb2ludCI6Imh0dHBzOi8vYXBpLmNvZ25pdGl2ZS5taWNyb3NvZnQuY29tL2ludGVybmFsL3YxLjAvIiwiYXp1cmUtcmVzb3VyY2UtaWQiOiIvc3Vic2NyaXB0aW9ucy9mNzg2MWFhMC1hOTliLTRmZmItODQzNS00MDBlMTI4NWU5YzEvcmVzb3VyY2VHcm91cHMvQW5hbHl0aWNzL3Byb3ZpZGVycy9NaWNyb3NvZnQuQ29nbml0aXZlU2VydmljZXMvYWNjb3VudHMvUnNwZWVjaCIsInNjb3BlIjoic3BlZWNoc2VydmljZXMiLCJhdWQiOiJ1cm46bXMuc3BlZWNoc2VydmljZXMuZWFzdGFzaWEifQ.hKGxtp19u_-QOw1DnIWvrFxphyTlYOxrgQODwlT4YhU",
+                       
+                       gender = c("Female"),language = "en-US",
+                       output_format = "audio-16khz-128kbitrate-mono-mp3")
Error in ms_synthesize("hey, how are you doing? I'm doing pretty good",  : 
  Unauthorized (HTTP 401).

I got the token from POSTMAN. software So, is there any code I am missing. Please need your support.

muschellij2 commented 5 years ago

Have you seen #2 ? I am not sure if this is resolved from the "free" API keys

mallick84 commented 5 years ago

Yes, I have seen the that but still not able to solve my issue. Is it really the issue of free Api key?

i am using Microsoft cognitive service on on trial basis.

On Sat, Dec 22, 2018, 8:15 PM John Muschelli notifications@github.com wrote:

Have you seen #2 https://github.com/muschellij2/mscstts/issues/2 ? I am not sure if this is resolved from the "free" API keys

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/muschellij2/mscstts/issues/3#issuecomment-449575289, or mute the thread https://github.com/notifications/unsubscribe-auth/AgucOj9erMbmGSxiM56p4KfSQo6G7Bn-ks5u7kWggaJpZM4ZfW6w .

muschellij2 commented 5 years ago

Can you try the new mscstts version I just pushed

devtools::install_github("muschellij2/mscstts")

and confirm the fix? If so, Merry Christmas!

mallick84 commented 5 years ago

Thanks, Merry Christmas to you. i will try and let you know.

On Wed, Dec 26, 2018, 1:05 AM John Muschelli notifications@github.com wrote:

Can you try the new mscstts version I just pushed

devtools::install_github("muschellij2/mscstts")

and confirm the fix? If so, Merry Christmas!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/muschellij2/mscstts/issues/3#issuecomment-449869803, or mute the thread https://github.com/notifications/unsubscribe-auth/AgucOoy5iQ4jPKtUPWBm54AnnmdbP2OOks5u8n4HgaJpZM4ZfW6w .