Google Drive sharing dialog blocked by x-frame-options, sameorigin - google-drive-api

I can not get the Share dialog to work for the life of me. I created a test page here: https://super.neutrondrive.com/edit?view=test
What am I doing wrong that I keep getting blocked by xframe?

It looks like the problem was I needed to have the app installed on the user's Google Drive. When using the backend api this is pretty easy to do, but when using the JS API this is not readily apparent.

Related

Google drive preview "/image" API doesn't work anymore?

Few days ago I was able to make request to:
https://drive.google.com/a/{{domain}}/file/d/{{docDriveId}}/image?pagenumber=1&w=400
Via this API I was able to get image preview on multi-page documents.
Seems it's there, but times-out after some time. It doesn't work anymore. Does anyone know what happened? It seems there's no documentation on this API.
On the other hand, I am aware of the thumbnailLink URL when getting document object via API, but this will only get 1st page preview.
Any alternative solutions to this?
Thanks a lot,
M
That URL is not a part of the official Drive API and is not guaranteed to remain stable. The Drive API doesn't include the ability to fetch per-page image previews of documents, but you may want to investigate using the embedLink as an alternative: https://developers.google.com/drive/v2/reference/files

Google-Apps-Script/Google-Drive cors issue

I have created a Google Apps Script in Google Drive. Although the script was created in Drive, it has a URL that looks like:
https://script.google.com/macros/s/blah-blah-blah
As a result, attempts to stuff the output from the script into a web page hosted on Google Drive fail as an attempt to access a cross-origin resource. Any way I can get around this problem? Thanks for any input.
... doug
you could publish the gas as anonymous content script and use ajax to get the data (redirects enabled) and use regular client+side js to display it on your googledrive html page.
Maybe its not working because you havent published as anonymous?
Ive done ajax to a gas content script from a googledrive.com hosted page and it worked fine.

Unmatched app urls when trying to publish to Chrome Store

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!

Incorporate Google Drive solution in existing Android app project?

I have an existing Android app project which has been already published on the Google Play, and now I would like to incorporate in my app the possibility to use the Google Drive possibilities in order to download *.jpg files directly to the sd card when the app is opened or load for the first time. Like this I liberate the internal memories of the phones where this app is installed (All the images are stored in the resources of the app actually which is >~ 20MB). I have read a lot of forums concerning the Google Drive SDK or API subjects and I can say that I'm a little bit lost on the manner to manage it for my present app. Some ideas or suggestions would be very very very appreciated.
Thank you very much).
Please see this question for the basics on how to integrate your Android app with Google Drive SDK: Access to Google Drive from self implemented Android application
In it, I reference a good Google+ tutorial on how to get started, and it's easy enough to take the concepts and apply them to an existing app. (That's how I did it too.) Before you get started, sign up for the Google APIs (https://code.google.com/apis/console/), get into the API Console, and turn on both the Google Drive API and Drive SDK. This'll make coding go a lot smoother. Let me know if you have any problems.
One addendum for your specific case relating to *.jpg files is you could set a MIME type for fetching strictly the pictures. It'd go something like this:
request = service.files().list(); // .setQ("mimeType=\"text/plain\"");
Unfortunately setQ is commented out because it would fail to return any results when I used it. However, you may have better luck with the image/jpeg MIME type.

I am facing "The authenticated user has not installed the app with client id" error even after installing the app [duplicate]

I'm working on a Google Drive interface for Emacs. The concept is that Emacs could provide a platform-agnostic way to load, modify and save text documents stored in Google Drive. I've registered my app and can authenticate with OAuth2 and get a file listing with the Docs List API, but when I try to execute an Insert with the Google Drive API, I see an error:
"The authenticated user has not installed the app with client id ..."
Reading further, it seems I need to publish my Emacs application in the Chrome Web Store to get access to the Drive API. That doesn't make sense to me...I noticed that there is a FUSE project in development for Google Drive, which suggests that native development is possible. When I skimmed the code, however, I didn't see a Chrome Web Store component to getting it working.
Am I trying to misuse the API, or is there an route to make this work that makes more sense?
EDIT:
According to Ali Afshar, of the Google Drive team, installation is no longer required to use this API. So what follows may no longer be relevant, but will be left for historical purposes.
So, first off the API does not support application development in the sense that we are both doing it, I wouldn't use the word native though. The good news is I have been doing some research and Google Drive is really just a rebranding of Google Docs. So the Google Docs API could be a good choice as well for the same purposes.
Anyway, here's the steps to solve the error: "The authenticated user has not installed the app with client id ..." Which is a 403 error, for the sake of this answer. These steps assume you have set up an app in the chrome web store as is required, and installed it. I am working on my local machine too, with my project: http://github.com/tom-dignan/gdrive-cli which I have gotten past this error, so I think you should keep plugging away at your emacs version, because I think we can make this work.
a. Open the Google APIs console.
b. Confirm you've already enabled the apis under "API Access" both the API and SDK for Google drive should be enabled. There you get your client secrets/api keys and such. I am almost positive you've done this already, so go ahead to C. (this is here for others who may have missed it)
c. In the left navigation bar, under "Drive SDK" you will need to do the following:
Add a "Support URL" (required)
Add at least a small 16x16 application icon (required)
Add "OAuth Client ID (Required)" under Drive Integration (I was just tinkering and this seems to be the key field.)
Add "Open URL (Required) URL to open for your app from the google drive UI."
Check off "Multiple File Support"
Add some MIME types and file extensions, "text/plain", and txt for example
Add the the auth scopes:
https://www.googleapis.com/auth/userinfo.email
https://www.googleapis.com/auth/userinfo.profile
Don't bother trying to add the auth scopes for Google Docs here, because it won't work. Google does not want us to use it that way because files that drive apps create should be private to that app. Integration with Google Docs will have to be separate.
Now I know you must be thinking "why do I have to add some of these..." It's because the form makes them required fields. In mine, I put a couple URLs that point to static HTML pages.
Once you've done the above, clean up your state and reinstall your chrome app. Then try your code again, and it should stop giving you a 403.