Why is google-app-script returning empty string on multiple account logged in instead of auth error.

243 views
Skip to first unread message

haris jamil

unread,
May 14, 2019, 3:48:44 AM5/14/19
to google-apps-sc...@googlegroups.com
I have a google app script application, which have doGet and doPost methods. Previously when user was logged in from multiple google accounts or if user does not had permission to that particular google-doc document it used to return auth error, but now it is returning just an empty string instead of proper response due to which i am unable to indentify type of error which occured.

i am using jquery .get method to send get request to Google-App-Script

Jquery.get( scriptUrl ).done( function( data ){
  console
.log(data); //emtpy String
} );



Can any one please help in resolving this issue?

Thanks alot

Jacob Edward

unread,
May 14, 2019, 2:59:27 PM5/14/19
to Google Apps Script Community
if you link to your GAS project I'll take a look at the code... you first need to deploy the script as a stand alone web app that runs as the user accessing the app instead of your main account, though if you want to build an offline PWA web app and still use GAS I recommend setting up your code so that it will be accessible by anyone, even anonymous and running the app as you and handling the user log in credentials with your own logic... in the middle of transitioning my own project and it would have been nice if I had done things differently the first time... really unfortunate that Google has designed their GAS system so it can't serve service workers...  This is how I've got my doGet function situated

function doGet(request) {
 
if (typeof request.parameters.keyer == "string") request = request.parameters;
 
else request = request.parameter;
 
 
if (request.work) return ContentService.createTextOutput(loadWorkFile()).setMimeType(ContentService.MimeType.TEXT);
 
else return HtmlService.createHtmlOutputFromFile("index.html").setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
}


function loadWorkFile() {
 
var workID = PropertiesService.getScriptProperties().getProperty("workFileId");
 
var html = DriveApp.getFileById(workID).getAs("text/plain").getDataAsString();
 
return html;
}
Reply all
Reply to author
Forward
0 new messages