I am testing the Speech API. By following the quick start instructions, I created a speech api project, and created a service account with it, and enabled billing. I have trouble to get authenticated.(1)gcloud auth activate-service-account --key-file=SpeechApi-72564282d5af.json
Activated service account credentials for: [serviceaccountkey-ying@speechapi-166721.iam.gserviceaccount.com]
(2)gcloud auth application-default print-access-token
ya29.GltFBIkvHR1DT_EKT5QdQ8g4_x1uS-UGUTpbheHaup9nloeD2A6Ql7fPSMlLKqt30JGJABvFf3JoarYXqCO3W5DHWQo4Pbe8NduXijtk-OxnDijcqC3VUrT2Hfm-(3)curl -s -k -H "Content-Type: application/json" -H "Authorization: Bearer access_token" https://speech.googleapis.com/v1/speech:recognize -d @sync-request.json{
"error": {
"code": 401,
"message": "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"status": "UNAUTHENTICATED"
}
}Can you help me on this? Thank you very much!Ying
--
You received this message because you are subscribed to the Google Groups "Google Cloud Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-dev/80c9fe79-86f9-46cc-975e-42da0add846d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
curl -s -k -H "Content-Type: application/json" -H "Authorization: Bearer **blah_blah**" https://speech.googleapis.com/v1/speech:recognize -d @response.json
Two points:- You probably shouldn't share your access token with public groups like this one; it will allow anybody who sees it to use your account. Fortunately, access tokens are short-lived (expire after ~1hr), so there's nothing more you need to do, but be careful in the future.- If I'm reading correctly, you put a literal `access_token` in the curl request; you need to substitute your actual access token.Hope that helps.
On Mon, May 8, 2017 at 8:59 PM, Ying Liu <yingy...@gmail.com> wrote:
I am testing the Speech API. By following the quick start instructions, I created a speech api project, and created a service account with it, and enabled billing. I have trouble to get authenticated.(1)gcloud auth activate-service-account --key-file=SpeechApi-72564282d5af.json
Activated service account credentials for: [serviceacco...@speechapi-166721.iam.gserviceaccount.com]
(2)gcloud auth application-default print-access-token
ya29.GltFBIkvHR1DT_EKT5QdQ8g4_x1uS-UGUTpbheHaup9nloeD2A6Ql7fPSMlLKqt30JGJABvFf3JoarYXqCO3W5DHWQo4Pbe8NduXijtk-OxnDijcqC3VUrT2Hfm-(3)curl -s -k -H "Content-Type: application/json" -H "Authorization: Bearer access_token" https://speech.googleapis.com/v1/speech:recognize -d @sync-request.json{
"error": {
"code": 401,
"message": "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"status": "UNAUTHENTICATED"
}
}Can you help me on this? Thank you very much!Ying
--
You received this message because you are subscribed to the Google Groups "Google Cloud Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-d...@googlegroups.com.