I have script that works fine on my account but I want other user to be able to use that script over API Executable.
var serviceScript = new ScriptService(new BaseClientService.Initializer()
{
HttpClientInitializer = UserInfo.Credentials,
ApplicationName = "Read Google Scripts .NET",
});
var scriptId = "scriptId";
var Param = new { spreadsheetId = spreadsheetId };
var exec = new ExecutionRequest();
exec.Function = "createDocument";
exec.DevMode = true;
exec.Parameters = new List<object>();
exec.Parameters.Add(Param);
var script = serviceScript.Scripts.Run(exec, scriptId);
//
var result = script.Execute();
This is the error I got when other user tries to access:
GoogleApiException: The service script has thrown an exception. HttpStatusCode is Forbidden. The caller does not have permission Google.Apis.Requests.ClientServiceRequest<TResponse>.ParseResponse(HttpResponseMessage response)
I am using OAuth 2.0 and after creating Apps Script I have two Client IDs
I have deployed script as 'Anyone with Google account' but it is not accessible over API and works fine as Web Application.
Looks it's only possible if I gave Editor role on script for everybody