❔ Google Api- PermissionDenied

Facing an access problem using the google Api NuGet:

`Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", _googleApiParams.CredentialsPath /path to JSON file/);
            _translationClient = TranslationServiceClient.Create();

            DetectLanguageRequest request = new()
            {
                Parent = "projects/my-project-name",
                Content = "this is a detection test"
            };

My Error: the exception:

`Grpc.Core.RpcException: 'Status(StatusCode="PermissionDenied", Detail="Cloud IAM permission 'cloudtranslate.languageDetectionModels.predict' denied. ")

This python code works howerver:

`self.translate_client = translate.Client.from_service_account_json(self.google_api_credentials_json_path)
                translated_text = self.translate_client.translate(values="this is a test", target_language=target_language,

Any Ideas for a fix?
Was this page helpful?