Accessing A Google Script Web App From Other Accounts
source link: https://cwestblog.com/2023/06/28/accessing-a-google-script-web-app-from-other-accounts/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Accessing A Google Script Web App From Other Accounts
Published by Chris West on June 28, 2023
Recently I wrote a Google Script Web App that generated JavaScript code and needed to run on a Google Site. Even though I tested everything both on my computer and on my phone I didn’t realize that if someone tried to access the same code while logged in as a different Google user they would get an error saying the following:
Google Docs encountered an error. Please try reloading this page, or coming back to it in a few minutes.
To learn more about the Google Docs editors, please visit our help center.
We’re sorry for the inconvenience.
– The Google Docs Team
Needless to say, this error is quite annoying especially since when investigating this further all it really tells you is that it is a 500 error. Fortunately I had encountered this before and remembered that this occurs when the person who is trying to access the Google Script Web App while they are logged into another Google account. On the other hand this error doesn’t seem to occur when you are not logged into a Google account.
The Solution
Let’s say that the Google Script Web App that is to be accessed is at https://script.google.com/macros/s/ABcdefgHi0JKlmn1OPQ23RS4TUVWXYzA_5BCdEfGHIjklmnO6pq_Rs7tuV8WxyZAbc9defg0hi/exec
. In order to make this Web App available to anyone regardless of if they are logged into their Google account or not you can insert “a/gmail.com/
” right before “macros/
“. In other words, https://script.google.com/macros/s/ABcdefgHi0JKlmn1OPQ23RS4TUVWXYzA_5BCdEfGHIjklmnO6pq_Rs7tuV8WxyZAbc9defg0hi/exec
would become https://script.google.com/a/gmail.com/macros/s/ABcdefgHi0JKlmn1OPQ23RS4TUVWXYzA_5BCdEfGHIjklmnO6pq_Rs7tuV8WxyZAbc9defg0hi/exec
.
It is really just that simple. Hopefully this easy solution helps you out and as always, happy coding!!!
Leave a Reply Cancel reply
Save my name, email, and website in this browser for the next time I comment.
× nine = 36
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK