On Google App Engine (GAE) written in Python.
I am trying to issue an http post to cloud-speech-to-text api and using URI audio source (Google Cloud Storage Bucket Objects).
I am using the following headers;
Authorization: BASIC encoded_base64(username:password)
But I still keep getting an error response below:
{ "error": { "code": 403, "message": "Anonymous caller does not have storage.objects.get access to bucket_of_secrets/four_score_seven_years.flac.", "status": "PERMISSION_DENIED" } }
So I have a couple of questions;
- Does BASIC Authorization Header work in Google HTTP API?
- What
username:password
should I use? Is it my GCP account email and password? i.e.handsome_dude@gmail.com:deluded_fool
Where handsome_dude@gmail.com
is the username and deluded_fool
is the password.
I've tried setting the bucket objects to be public readable and of course the http call works... but I would rather avoid setting my bucket objects public readable.
Here's a sample Curl request:
curl -X POST
https://speech.googleapis.com/v1/speech:longrunningrecognize?key=<secret_api_key> -d @sample.json -H "Content-Type: application/json, Authorization: Basic base64encodedusername:password"
Here's a snippet in my python code using urlfetch:
url_post = urlfetch.fetch(url=speech_to_text_url_post, payload=json.dumps(data_to_post), method=urlfetch.POST, headers={"Content-Type" : "application/json", "Authorization" : "Basic "+encoded_user_password})