I don’t think Google could have come up with a more confusing and convoluted 
system for API permission management if they tried.

So I’ve enabled the “cloud translation” API within my project.

I have some Python (2.7, old school) code that goes:

credentials = 
ServiceAccountCredentials.from_json_keyfile_name(CLIENT_SECRETS_FILE, 
scopes=['https://www.googleapis.com/auth/cloud-platform’])
http_auth = credentials.authorize(Http())
service = build("translation", "v3", http=http_auth)
service.projects().translateText(parent=“projects/my-project-id-here",body={"contents":"bonjour",
 "targetLanguageCode":"en"}).execute()

And I get:

googleapiclient.errors.HttpError: <HttpError 403 when requesting 
https://translation.googleapis.com/v3/projects/my-project-id-here:translateText?alt=json
 returned "Cloud IAM permission 'cloudtranslate.generalModels.predict' denied.">

So it seems like I need to check some box somewhere to make this work, but I 
can’t figure out where.

The service account in the client secrets file is working fine when I use it to 
hit Google Analytics from the same app. And in fact, my code to access GA is 
almost identical except the scope and service call.

Any ideas?

-Joshua

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/DB3B5905-5B08-4A6C-8CC9-789E61E49712%40gmail.com.

Reply via email to