I have a Google Apps Script for Google spreadsheets which opens a secondary browser window (for authentication to an external system).
After the authentication we get a redirect to the webapp part of the script (doGet).
How do I close the browser window from Google Apps Script (so that the user can continue in the spreadsheet)?
I changed the design to solve the issue:
1) I do no longer use a webapp in GAS to wait for some authentications codes. We instead poll (via UrlFetch) our server from the GAS side until the authentication has completed.
2) I now let the authentication window close itself
window.open("","_self","").close();
The code might look tricky, but it works with current browsers. ( The more natural looking window.close() doesn't).