I can't open my Web App Link on Google App Scripts when multiple Gmail accounts logged in - google-apps-script

Great day to you!.
I have found an issues when open Web App with multiple Gmail accounts logged in as an image attached.
My Web App link: https://script.google.com/macros/u/3/s/AKfycbzKLT0u7rE-hQbdJss2-1J-hyiWirkwUglfk6S8ColrARApgnFAJgyTStDf7pdxLCwp/exec
After several searches on Google and Stack Overflow,
My current findings are:
Sign out all accounts and sign only one account (Google Web App Multiple Google Accounts Error)
Open New Incognito Tab then sign in one account
(Google Web App Multiple Google Accounts Error)
Create alert pop-ups(https://sites.google.com/site/scriptsexamples/home/announcements/multiple-accounts-issue-with-google-apps-script)
However, I think it's an extremely better if they can open Web App Link while they are logging in multiple Google accounts.
Therefore, my question is
"How do we open Web App by Google App Script while Google accounts logged in?"
Thank you.

This is a well known issue and is filed on Google Issue Tracker
While this issue is being worked on, unfortunately the only feasiable workaround is toUnfortunately is to NOT being signed in with multiple accounts.
I also recommend you to "star" this issue on Issue Tracker to increase the visibility and hopefully accelerate fixing.

I had a similar problem in the company I work for and we found a way to work around it. Maybe it is the same to you, or it could help someone else.
We had to access to our web app with the company account (g-suite accounts), but some of us had multiple accounts logged in. Basically, we needed to open the web app with a specific account, the one of our company domain.
Our solution was to log out all the accounts and then to start to log them in again, beginning with the account that have to access the web app. In this way, that account became the main account and it can finally open the web app, since they belong to the same domain.
This solved the problem for us.

Related

Embedded Google map not showing when using more than one Google account [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 1 year ago.
Improve this question
I've embedded a Google map that I created using Google account A.
If I am not logged in to any Google account and visit the website then the map works fine.
If I log in to one Google account (let's say Google account B) and visit the site then the map works fine.
If I 'Add another account' or sign in to another Google account (let's say account C) in the same browser then I get a little red monster icon instead of the map and the message "www.google.com redirected you too many times".
If I sign out of all Google accounts then the map works fine.
Again, if I sign in with one account then the map appears correctly.
Does anyone know why this is and how I can fix it? I'm finding that quite a few people are running two Google accounts.
There's no message in the console. We use Drupal but I've embedded the map in a simple HTML page and the result is the same as above, so I guess it's a Google issue. I couldn't find anything online about it, except a comment in a Scandinavian forum that maps don't show if you are logged in with more than one account.
It's also not a problem with the maps' sharing permissions. They are all public.
Update:
I've narrowed the problem down a bit. This isn't an issue on our web server because, as I mentioned, I can replicate it in a static HTML page opened from my desktop in a browser, with no server, CMS or .htaccess file involved. Instead it appears to be an issue related to my institutional Google account. I have two personal accounts and an institutional one.
If I log in with my institutional account first then sign in with
another account the maps don't work.
If I sign in with a personal account then sign in with my institutional account the maps work.
If I sign in with any combination of the personal accounts then the maps
work.
So the problem occurs when I'm signed in with the Google account provided by my institution, then I sign in with another Google account. It doesn't matter which account created the map.
So here's the answer: the administrators of the institutional GSuite account had not enabled Google Maps for our accounts.
According to this thread the first Google account you log in to is treated as your default account. So when I logged in to my institutional Google account then logged in to another account my permissions were inherited from my institutional Google account.
That doesn't explain why I can see the maps when I am only logged in to my institution account, but it seems from comments online (like in the thread I linked to) that accessing services through multiple accounts can be buggy.
So the error message given by the browsers wasn't helpful in this case. The root cause wasn't to do with redirects but account permissions to view maps.

Google Drive Page Not Found - Sorry, unable to open the file at this time

I'm using google scripts to deploy a web app. I've done about 5-10 in the same account. When I try and run the web app/script, I'm now getting: a "Google Drive: Page not found" in the title and the message
Sorry, unable to open the file at this time. Please check the address and try again.
I published it to run as the owner, but accessible to "Anyone, even anonymous".
I then tried creating a new small project with a doGet() method that returns a small static web page, with the same result.
Code.gs:
function doGet(e) {
return HtmlService.createHtmlOutputFromFile('Test');
}
Test.html:
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
This is a test
</body>
</html>
I tried publishing the same spreadsheet/code above in my personal account and it works fine. Since I already have some web apps deployed with the account that's having the error, is there a quota on the number of web apps per account?
I tried a different browser, a different account, re-publishing, and logging out and back in. Same error message. The "Test your web app with the latest code" link also fails. I can directly call the doGet() method in the IDE and it works fine, and I see output in the logs.
I don't see anything in the logs for the page not found error, which is what I expect with the page not found - not even getting to code execution, thus no logs.
I think you are logged in with two gmail account: That is why (/u/1,/u/0) may have been appended to script address (may be a bug).
So what you have to do is remove /u/0 or whatever is appended.
ForExample:
https://script.google.com/macros/u/1/s/ffffsdds/exec becomes https://script.google.com/macros/s/ffffsdds/exec
I have several Gmail accounts open at once and kept having this problem. I found it helped to close the Drive window, log out of the email account related to it, and then log back into the Gmail account and open Drive again.
You need to add your organization domain to the URL, as in https://script.google.com/a/yourdomain.com/macros/s/ffffsdds/exec - note that a/domain.com has been added. If you're not using a custom domain, use a/gmail.com.
It works when you are logged in to multiple accounts and redirects to
https://script.google.com/macros/s/ffffsdds/exec when you are not logged-in to the particular domain account.
Background info:
https://script.google.com/macros/u/1/s/ffffsdds/exec - does not work if you are logged-in with multiple accounts
In https://script.google.com/macros/s/ffffsdds/exec - "/u/x" has been removed but if you visit that URL, it will still redirect to https://script.google.com/macros/u/1/s/ffffsdds/exec and (1) problem remains when you are logged into multiple accounts (however it works if you are not).
It looks like it's related to this issue: https://issuetracker.google.com/issues/69270374. Authentication is broken for multiple signed-in accounts.
As Google developers suggests, you should:
Signing out of all accounts and using only 1 account: or
Using an incognito tab to sign in
source (comment 292).
What is sad is that, as they said:
The issue originally reported is due to recent improvements in Sheets' ability to handle multiple logged in accounts.
source (comment 11)
So by improving multiple logged in accounts, they also broke it.
Now the "good" news: we can expect this to be fixed in about 1 year I would say.
Our team plans to begin to work on multi-login support for the new Apps Script IDE and container-bound scripts in Q3 ‘21.
source (comment 292)
All the above answers are relevant. But for me, the issue was due to lack of space in Google account. I've used all 15GB space provided by Google and then all my Google Forms started showing the above error.
Solutions are:
Buy extra space from Google, it wont cost much. For 100GB, it costs Rs.130/month or Rs.1300/year
Free up your space. Go through the Google Drive and you may find a lot of unwanted files. Delete it and make some free spaces.

How to remove Warning "This application was created by another user, not by Google" in Google Apps for Education

We set up a Google Apps Script-based Intranet in our organization, which benefits from Google Apps for Education. We've been using for months:
doGet()
HtmlService.createTemplate(...)
Publish > Deploy as Web App and setting:
"Execute the app as:" admin#ourdomain.com
"Who has access to the app:" Any member of ourdomain.com
Everything worked ok up to now.
However today (July 7th. 2017) the HTML pages to be shown to the intranet users include an inconvenient Warning added by Google at the top claiming that This application was created by another user, not by Google., which is really annoying. I understand that this warning must be shown when the Script is created by an unkown users. But in my case, I (the admin) is offering the Script to the users of my organization.
The conclusion in other past threads is that going Google Business or Education everything gets fixed. Unfortunately, it's not true anymore.
Does anybody know how to avoid such warning in Google Apps Script for the users of our domain that run our own coded scripts?
if you have a website just embed the google script into an iframe in your website just ensure in your doGet function set return to html.setXframeOptionsMode(HtmlService, XFrameOptionsMode.ALLOWALL)
function doGet() {
var html = HtmlService.createHtmlOutputFromFile("index");
return html.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
}
Then in you website
<iframe scr="PASTE YOU GOO0GLE WEB APP LINK HERE"></iframe>
you can use css to resize the iframe as you like, i actually learnt this when watching a youtube video , in the ending of the video the instructor embed the google web app which he had created in the video in his website
enter link description here
He also left a link in the description of the video to His github page where he pasted the source code
Bad news. Evidently this is the intended behavior from here on out.
https://issuetracker.google.com/issues/63521070#comment4
mc...#google.com #4 Jul 11, 2017 04:42PM
Status: Won't Fix (Intended Behavior)
To combat abuse, we recently expanded display of the "created by another user" banner to include all cases where either (1) a web app is published under a Gmail account and accessed by a user other than the publisher or (2) a web app is published under a G Suite account and accessed by a user outside the publisher's G Suite domain/customer.
We understand that legitimate applications are also affected by this change, and we hope that broader display of the banner informs users while still allowing developers to deliver useful, usable applications.
I'm affected too. I guess I'll just live with it - only impacts one small web app for me. As a Nonpofits user I'll take what they can give. (A heads up would have been nice though.)
I realize others have more at stake than I do - I hope you can find a workaround.
Same thing has been happening to us. We have a G Suite for Nonprofit account (formerly Business) and have published webapps for several years via this account without the warning showing up. Users began telling me yesterday July 6 2017 that the warning now appears across all our webapps.
I just created a test webapp where "Execute the app as" is set to an admin of our account and "Who has access to the app" is set to "Anyone, even anonymous". As you can see https://script.google.com/macros/s/AKfycbxrKgPol_-eEskKzqRzN4WAMj-NiPm7iFavjZu-_vWtTJPyAEkK/exec does display the warning.
Something I just noticed, the generated webapp script's url now starts with script.google.com/macros/s/ whereas before it would have included our organization name (e.g. script.google.com/a/macros/rchsks.org/s/). So, the url will change if I go back to redeploy one of our existing webapps -- that will screw up several things, the least of which are bit.ly links pointing to the old url.
Not having these warnings appear was one of the benefits I read about when we considered signing up for what was then called a Google Apps account. I'm an admin of our account and received several G Suite alert emails on July 6 2017 about problems occuring with Google Drive, Calendar, Hangouts, etc. Maybe those are connected?

Web App execution/access scope

When I deploy my GAS project as a web app, I choose to execute the application as the user accessing it. The option for 'Who has access to the app' I can choose just myself, or everyone in my domain. This I understand.
However, in our Google Apps environment - the domain I belong to is one of many 'sub-domains' under one 'tld' domain to which I have an admin account. I don't have privileges to go full exploring in the control panel to see the exact organization, but I know that I can share docs to everyone in all domains via my Drive. How can I get my script to operate in a similar manner?
There are a couple of good resources on this topic.
Stackoverflow question which links to this
Google support answer
With Google Drive, "You cannot restrict sharing to the users in a single domain". I haven't found an answer to this, but this was the closest that I could find. It seems that you will just have to test if "Anyone in my domain" actually means "Anyone in my organization." If you can test this and report back, I will update this answer.

Google API Service Accounts with Drive SDK

I'm looking for some clarification on accessing Google docs/Drive SDK via a Service Account.
I have everything set up in the API Console and I can successfully generate an access token via the JWT process and indeed I can issue requests to either drive SDK or the Docs List API to get a listing of documents. However, the document listing is always empty, I was expecting to see all the documents in my Google Drive. I am obviously not understanding fully what a service account gives you. If I upload a document via the Service Account then it does show up correctly, but is not visible in my Google Drive, it's as if the Service Account is a totally separate black box.
The reason I want to use Service Accounts is that I have a service running that needs to upload documents to various clients Google Docs accounts, without them having to go through the OAuth dance as there will be no UI interaction at all. Is this possible with Google docs. I was hoping that they could just send my the client_email and the certificate with the private key and I would be able to upload documents to that account.
Many thanks for your consideration
-Marshall
Not sure whether you need the answer anymore, but I just faced with the same issue, came to this post. Found one solution which works in my case, so sharing with everyone here.
The only integration point towards GoogleDrive in my case is document listing.
When I first created my service account, it didn't work as well (just empty list all the time).
What did I do to fix it:
Go to MyDrive UI https://drive.google.com/#my-drive
Checked all the documents I want to see on my website
In the top menu clicked "More"->"Share..."->"Share..."
In "Add people" section (new window "Sharing settings (N items)") I added service account email (format is "XXXXXX##developer.gserviceaccount.com")
Run document listing once again and got it working.