Hi Mario, that sounds like an interesting little utility there.
The target API uses the “current authenticated user” to do everything. So in AppsScripts, depending on who is running the script, that is the user that is authenticated if you use that advanced service. AppsScripts will handle that for you, which is one of its core features that lowers the bar of entry.
But you can peal back the layers by interacting with the target API endpoint directly, with UrlFetchApp.fetch instead of Tasks. You also need to set up an service account, which isn’t hard to do, but only google administrators can do it.
Then you can use an oauth2 lib, which you send it the username/password info of the service account (client ID/secret), and the token provided by that library to authenticate with those UrlFetchApp.fetch calls.
I’m afraid I’ve given a lot of information that might be not so clear, but I’m hoping that aids you in next steps.
Regards,
Adam
--