Dynamic translation using Google api not working as expected

Prem5
Tera Contributor

Hi all,

 

We have a business rule calling the Google translator api to translate a field value from different languages to English. Below is the code

 

var gr = GlideRecord("asmt_metric_result");
gr.addEncodedQuery('metric.metric_type.evaluation_method=survey^sys_id=afc4d440db8e715023d73423e29619d5');
gr.query();
while (gr.next()) {
    var sobj = sn_dt_api.DynamicTranslation.getTranslation(gr.string_value.toString(), {
        "targetLanguages": ["en"],
        "additionalParameters": [{
            "parameterName": "texttype",
            "parameterValue": "plain"
        }],
        "translator": "Google"
    });
    var trans = sobj.translations[0].translatedText.toString();
    gs.info("Translated text: " + trans);

    gr.u_string_value_english = trans;
    gr.setWorkflow(false);
    gr.autoSysFields(false);
    gr.update();
}

 

It was working fine for the past 1 year and started returning an error as below from the past one week

 

sn_google_trans: Error while translating the text to language using Google Cloud Translator. Error:Request had insufficient authentication scopes.Response received:{
  "error": {
    "code": 403,
    "message": "Request had insufficient authentication scopes.",
    "status": "PERMISSION_DENIED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "ACCESS_TOKEN_SCOPE_INSUFFICIENT",
        "domain": "googleapis.com",
        "metadata": {
          "service": "translate.googleapis.com",
          "method": "google.cloud.translation.v3.TranslationService.TranslateText"
        }
      }
    ]
  }
}

 

I thought it is an issue with the Oauth credential setup, but we are getting the tokens as usual. Any inputs on how to trouble shoot this issue is appreciated.

 

PS: Yes, we the Dynamic translation spoke properly installed and configured. 

1 ACCEPTED SOLUTION

Aman Gulati
Giga Guru

I did get a response from SN Support to do the following to fix the issue

changing the custom claim on jwt provider record from "https://www.googleapis.com/auth/cloud-translation" to "https://www.googleapis.com/auth/cloud-platform"

View solution in original post

6 REPLIES 6

JitendraT
Tera Expert

@Prem5 , I am also facing the same issue, I am reaching out to Google Support, If I get some input. Will share in this post.

Prem5
Tera Contributor

@JitendraT  Did you happen to get any reply from the Google Support? Please let me know. Thanks.

Aman Gulati
Giga Guru

We are seeing the same issue. It was working in Tokyo version and now failing on Vancouver. Did anyone figure out the issue?

It stopped working in Utah version also. For our Google support ticket they have confirmed no issues from Google side.