When I try to publish a google script, it keeps loading with a message that says "getting data" or something like that but in spanish.
And it never ends, it keeps saying that.
I have trying cleaning the cache and cookies, also try with private browsing
It never ends loading, then it won't let me publish it.
How can I publish the script?
This is an image of the message that appears in spanish
It says Deploy as a web app and below, getting data.
If it is not a temporary server problem, it should be an error message not displayed. When the modal appears try to open the network tab of browser inspector and open the underlying sharingService request. The JSON response could contain a message like this or a little different:
Web apps can be enabled or disabled only by the script owner
Related
i've been learning with google app script, and tried to make a web form because of the limitation of google form. I tried making it by following this example, and it works. However when I tried using incognito or other browser without a google account log on to it, it failed, showing this error
"Maaf, terjadi error pada server saat membaca dari penyimpanan. Kode error INTERNAL."
Which is in Indonesian that basically states the server failed to read the file, and there is an internal error. This is the web app script.
Settings for the web app deployment
Also in the spreadsheet linked is set to anyone with link is able to edit. When this is changed to anyone with link is able to view only, causes a log in prompt to appear in incognito mode.
Any help is greatly appreciated. I also found out earlier that this problem occurred previously because of a bug by google, but it has been resolved. So did I do something wrong?
According to the Apps Script Web Apps documentation:
The first is labeled Current web app URL and ends in /exec. This URL is for the published version of your app, based on the last version you saved and deployed.
The second is the link labeled latest code and ends in /dev. This URL can only be accessed by users who have edit access to the script. This instance of the app always runs the most recently saved code — not necessarily a formal version — and is intended for quick testing during development.
Therefore, when sharing the web application, you should be sharing the /exec link.
There is an open bug for this: https://issuetracker.google.com/issues/160665120
I am trying to run Google Drive API using Google Client V3 in PHP. I have credentials for my locahost site set up, have downloaded the JSON and load the client with those credentials and on my local site everything works fine.
When I move it to the live site and download the JSON for the the project we use on the live site I keep getting a redirect_uri_mismatch. I've checked the console for this project and the redirect uri's are set correctly. I have the following for redirect uri
https://www.awesomestories.com/Google/getClient
https://awesomestories.com/Google/getClient
https://www.awesomestories.com/Google/getClient/
https://awesomestories.com/Google/getClient
I realize this is over kill but I wanted to make sure every possible version was set to eliminate this as the problem. The Google prompt is happening and when the code is returned and I try to to load the code parameter into Google client:
$resp = $client->authenticate($_GET['code']);
I get the following response
array(3) {
["error"]=>
string(21) "redirect_uri_mismatch"
["error_description"]=>
string(11) "Bad Request"
["error_uri"]=>
string(0) ""
}
The url that it is being redirected to is
https://www.awesomestories.com/Google/getClient
Which matches what is set in the console. Also we use this same project's credentials on the site already although we are just using the API key associated with this project not the Oauth2 credentials which GoogleClient is using. So for this project this is the first time we are using the Oauth2 credentials set up in the Google Console. I just can't figure out why the authentication is succeeding on the test site but not on the live site.
Another thing that is strange is that initialization of the client looks like this:
$client = new Google_Client();
$client->setAuthConfigFile(SYSTEM_PATH.'/shared/php/google-api-php-client/client-prod.json');
$client->setAccessType('offline');
$client->setApprovalPrompt("force");
$client->setPrompt("consent");
and on my local site when the google prompt authorization screen comes up it asks to allow offline access, but on the live site it never asks to allow offline access.
If someone could point me to what is going wrong I would really appreciate it.
So I don't know why this worked, but it did. I removed all the redirect uris from my console with the project associated with this, ran my code and at prompt screen got a redirect mismatch uri error as expected, I then re added the redirect uris, copying the one from the error message displayed on the prompt and then ran my code and the call succeeded. The strange thing is that the redirect I copied from the error message was the same that was in there before, because I copied the ones I deleted and compared them so I have no idea why this worked. Also before when I set the Google Client with the redirect uri the prompt screen went through fine without a hitch it was only when trying to load the authorization code sent back from Google prompt screen that the uri mismatch error would show up. I've ran Google prompts before where the redirect uri was set incorrectly on the client and this error appears in the prompt screen, so I'm not positive what was going on here, but it now is working.
I'm trying to develop a simple web app using google script web app service and access it from another script using the UrlFetch service.
My problem is that in order to try the code on my web app I have to publish a new version every time because trying to access to the dev URL returns returns and HTML file telling me to sign in even though I've set the permissions for the web app to everyone, including anonymous (if I hit the production URL it does work, though).
I'm assuming that Google is limiting the access to the dev URL for security reasons but can someone shed a light on that assumption?
PS: I don't know if this is relevant but my google account is in a Google Apps for Education domain
Edit
I've found a method to avoid publishing the application for each code change: instead of calling it from the UrlFetch service, I've created a function in the web App code that does call the doPost or the doGet method (I've to create the request param, but that's easy) and I've changed the end of the script to log the result insted of returing it to the client. When the application will be ready, I can publish and develop the client using the UrlFetch.
Anyhow, if anyone knows about the limitation of the dev URL that would be great!
your assumption is correct, the dev url ignores your publishing permissions on purpose, only the developer has access to that url.
you could accomplish what you want using libraries. move the code in your called script to a library and add it to that script as "development mode" and publish your script service.
changing library code should also change your service because its on development mode.
Note that this can easily break your app if you save partial code changes, and makes it hard to test your changed code unless you make all changes and tests in a separate script copy. Making several changes at once in multiple apps script editor files is possible with their "Save all" File menu command (after manually pasting all code changes from your tested copy).
I'm getting the following error when I try to publish:
This hosted web app has one or more app urls not owned by the developer.
The web_url of this hosted web app is not owned by the developer.
I am getting the green warning box as described in:
https://code.google.com/p/google-apps-script-issues/issues/detail?id=1520
However, I'm hitting the refresh button and no joy in the solving the problem. I've published a lot of apps scripts in the past and never had this issue.
You have to register your url with the Google webmaster tools program and they will give you code to fix this. In case you have already done that, just go and verify again. It happened to me as well and I had to verify the site again. It works!
I'm following this article, trying to add a sharing dialog in a web app.
I got the button working in opening the modal popup, but it just prints this error in the console:
Refused to display 'https://drive.google.com/share?id=SOME_LONG_ID&foreignService=explorer&shareService=explorer&shareProtocolVersion=2&command=init&subapp=10&popupWindowsEnabled=true&shareUiType=default&rand=1386925457304&theme=2&client=postMessage&appId=MY_APP_ID&embedOrigin=http%3A%2F%2Fmy_app.appspot.com'
in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.
And the modal itself just shows the message "Sorry, sharing is unavailable at this time. Please try again later."
For the checklist at the bottom of the article:
The user is signed in to Google True
The user has installed your app False How do I ask them to install?
The URL of the page that launches the dialog must have the same origin as the Open URL registered for the app. True
So I have 2 questions:
How do I ask them to install my app? It's supposed to be a web app, where there's 1 button to select Drive files via the Picker API (which is now working), and then another button which will sow this Drive sharing dialog to set the permissions of the selected files. There's no need for installation. Will it work for this setup?
What should be the value for the APP_ID? I'm guessing it's the ID in the "Drive SDK" section of the Cloud Console? The console is so confusing and there's so many values for keys, ids, etc. that I have no idea which to use. Here's a screenshot of what I mean by the ID and what I'm trying to use.
(1) Installing means you have to get the user to accept the drive.install scope - instructions here. This will integrate your app with the "open with" menu in Google Drive. But before that can work you will need to tell the Google Cloud Console what url to go to when the user clicks "open" - more instructions. In your case, since you don't actually want to allow the user to open files from Drive you won't be defining any file types, so in reality there won't actually be any visible integration with Drive.
Note that the share dialog will only work on the one page which has the url you specify as the target for "open" (the instructions say this and from experience it seems to be true).
(2) Client ID You can find this in the Google Cloud Console - see above. Mine is a 12 digit number, so yours will probably be too.
I had the same problem. The iFrame error shows up when you call setItemIds if your app_id is wrong. No idea why. Anyway, it started working for me when I used the right app_id -- the one that shows up like in your screenshot.