Does Google Translation V3 support grant_type as client_credentials

539 views
Skip to first unread message

Ankit Chauhan

unread,
Jun 28, 2019, 5:01:53 PM6/28/19
to Google Cloud Translation API
Hello everyone,
   I am trying to implement Google Translation V3. To generate the access token via postman, the following are my configurations:

Client ID - My client ID
Client Secret - My client secret

The error message I am getting is :
  • "unsupported_grant_type"
  • "Invalid grant_type: client_credentials"

 Someone on Stack Overflow mentioned that Google does not support it. Can someone please assist me whether Google Translation V3 supports Grant Type as Client Credentials or not? Thanks in advance.

 


Jun (Cloud Platform Support)

unread,
Jul 1, 2019, 2:57:00 PM7/1/19
to Google Cloud Translation API
Hey Ankit,

Per the documentation of Cloud Translation Introducing v3, the Cloud Translation v3 does not currently support API keys. You'll need to create a service account for the Cloud Translation v3beta1 requests. 

For more information on creating a service account, please look into Creating and Managing service accounts, and your service account must be added to one of the IAM roles added for Cloud Translation v3. 

Ankit Chauhan

unread,
Jul 4, 2019, 2:15:30 PM7/4/19
to Google Cloud Translation API
Hi Jun, 
 
  Thanks for your reply but here I am not using 'API key' for the credential part instead I am using 'OAuth client ID' to generate the Client ID and Client Secret which I think Google supports? 
Then using the Client ID & the Client Secret with grant_type as Client Credentials, I am trying to generate the Token which I will use to get the translation of a given text.

Jun (Cloud Platform Support)

unread,
Jul 4, 2019, 5:42:07 PM7/4/19
to Google Cloud Translation API
Hi Ankit, 

Amendment to my previous message: from the OAuth 2.0 Scopes for Google APIs, it is documented that only the Google Cloud Translation API v2 supports this so v3 does not support OAuth 2.0

Ankit Chauhan

unread,
Jul 8, 2019, 8:49:09 AM7/8/19
to Google Cloud Translation API
Hi Jun,
 We are planning to use V3 API using HTTP (via Postman). We have created a service account as well but not able to get the documentation (apart from using Google Client library code) for Authorization part. Is there any way to configure and test the V3 API via HTTP?

Jun (Cloud Platform Support)

unread,
Jul 8, 2019, 4:31:00 PM7/8/19
to Google Cloud Translation API
Hi Ankit, 

As to your last question of testing the API v3 via HTTP, it seems that the most convenient way to do this is to follow the Quickstart (v3beta1) steps to use curl to make POST requests to the v3beta1 endpoint. 

Ankit Chauhan

unread,
Jul 9, 2019, 3:50:59 AM7/9/19
to Google Cloud Translation API
Hi Jun,
  I have already tried via curl command and its working fine for me. I am also able to get the token via postman with grant type as jwt-bearer (https://developers.google.com/identity/protocols/OAuth2ServiceAccount) but I am looking for a way with grant type as client_credentials using Postman and my Google Service account (Google private keys) such that I can have my tests run without any user intervention.

LangPoC LangPoC

unread,
Nov 19, 2019, 6:34:33 AM11/19/19
to Google Cloud Translation API
Through javascript  can i genarate jwt token or access Token to call Automl Model text translation

Jun (Cloud Platform Support)

unread,
Nov 25, 2019, 9:00:02 AM11/25/19
to Google Cloud Translation API
Hey LangPoC, 

From the documentation Translating text using an AutoML Translation custom model, the call to AutoML Model text translation is using Cloud Translation API v3beta1 translateText method (it is using the access token instead of jwt token)

Jun (Cloud Platform Support)

unread,
Nov 25, 2019, 9:08:33 AM11/25/19
to google-tra...@googlegroups.com
Hi Ankit, 

Per this StackOverflow post [1], The Grant Type: Client Credentials (client_credentials) is not supported with Google APIs.

Reply all
Reply to author
Forward
0 new messages