The default way for authenticating a service account for using the Google Translate V3 API is by means of an environment variable. This env var, called GOOGLE_APPLICATION_CREDENTIALS, points to a json file with the credentials, as described here: https://cloud.google.com/docs/authentication/production
However, how can I use the required credentials when using a file in a different location? I am able to create the credentials object from a FileStream alright, as described in the google documentation. However, using this credentials object is only docmented for google cloud storage. The Builder for the TranslateTextRequest does not accept such a credentials object. https://googleapis.dev/dotnet/Google.Cloud.Translate.V3/2.0.0/api/Google.Cloud.Translate.V3.TranslateTextRequest.html
The only workaround would be to copy the file to the location specified in the env var, but this seems odd and would fail when that variable isn't set.