Hello @karl_jones ,
it would be really great to add ServiceAccount type of Authentication to the SheetServiceProvider. We already did it ourself simply like this :
SheetsService ConnectWithServiceAccount()
{
GoogleCredential userCredentials;
var jsonFile = Environment.GetEnvironmentVariable("LOCALIZATION_GOOGLE_SERVICE_ACCOUNT");
userCredentials = GoogleCredential.FromFile(jsonFile).CreateScoped(k_Scopes);
SheetsService sheetsService = new SheetsService(new BaseClientService.Initializer
{
HttpClientInitializer = userCredentials,
ApplicationName = ApplicationName,
});
return sheetsService;
}
Thank you
4 Likes
Thanks. Iām not familiar with service accounts but ill look into it.
1 Like
how can i add it myself? It is in packages folder an i ont have acces to change it
Lukas-Labaj:
Hello @karl_jones ,
it would be really great to add ServiceAccount type of Authentication to the SheetServiceProvider. We already did it ourself simply like this :
SheetsService ConnectWithServiceAccount()
{
GoogleCredential userCredentials;
var jsonFile = Environment.GetEnvironmentVariable("LOCALIZATION_GOOGLE_SERVICE_ACCOUNT");
userCredentials = GoogleCredential.FromFile(jsonFile).CreateScoped(k_Scopes);
SheetsService sheetsService = new SheetsService(new BaseClientService.Initializer
{
HttpClientInitializer = userCredentials,
ApplicationName = ApplicationName,
});
return sheetsService;
}
Thank you
You can move the folder out of the Package cache folder and into your projects Packages folder, then you can make changes.
Hi everyone ā I ran into the same limitation around using a Service Account with the SheetsServiceProvider, so I put together a walkthrough showing how to set up Google Sheets with the Unity Localization package using a Service Account.
Video: https://youtu.be/bsEYavsGfJs
This approach avoids the ongoing maintenance required by the OAuth flow and has been working reliably with the current Localization package.
Hopefully the steps in the walkthrough help anyone trying to get a CI-friendly setup running
Hope this helps ! Cheers
2 Likes