I have two Google account organizations.
code.gs
function myFunction() {
var html = HtmlService.createHtmlOutputFromFile('dialog.html');
SpreadsheetApp.getUi().showModalDialog(html, "test");
}
function test(){
console.log("test");
}
dialog.html
<html>
<head>
<script>
function run(){
try{
google.script.run.test();
}
catch(e){
console.log("e: "+e)
}
}
</script>
</head>
<body onload='run()'>
</body>
</html>
I ran myFunction() from new script editor. Everything worked fine.
After that I logged to my second organization and I did same steps. But in this case chrome returns me Uncaught error. I also tried to change project to GCP and read logs. Everytime I tried to call google.run.script.test(), I got this error to my gcloud logging:
Authorisation is required to perform that action.
So I assume this could be the issue. But I was not able to solve this after many hours of struggling.
Is there any organization or account settings which could affect using google.run.script?
Many thanks.