google-api-js-client

google drive javascript api gapi.client.drive.files undefined

被刻印的时光 ゝ 提交于 2019-11-30 13:26:37
The JavaScript example to list files of Google Drive uses gapi.client.drive.files.list() . When trying to use this method I get the error "Cannot read property 'files' of undefined". The issue and a workaround are already described under Google Drive API javascript Is the documentation under https://developers.google.com/drive/v2/reference/files/list#try-it incorrect? Or is there a way to use the API as described. The JavaScript example is correct, but you have to make sure that you only use gapi.client.drive.files (and the other Drive-specific resources) when the Drive library is loaded, i.e.

Google Drive and CORS Cross Domain Requests

橙三吉。 提交于 2019-11-30 09:14:54
问题 I have been wracking my brain trying to figure out how to download a file from Drive in Internet Explorer. It seems that Cross Domain security concerns are preventing this. A simple 'GET' using XMLHttpRequest works fine in Chrome and Firefox, because it supports request headers, which allow the browser to request a CORS response, as shown in the following lines of code: var xhr = new XMLHttpRequest(); xhr.open('GET', file.downloadUrl); xhr.setRequestHeader('Authorization', 'Bearer ' +

google drive javascript api gapi.client.drive.files undefined

南笙酒味 提交于 2019-11-29 19:08:31
问题 The JavaScript example to list files of Google Drive uses gapi.client.drive.files.list() . When trying to use this method I get the error "Cannot read property 'files' of undefined". The issue and a workaround are already described under Google Drive API javascript Is the documentation under https://developers.google.com/drive/v2/reference/files/list#try-it incorrect? Or is there a way to use the API as described. 回答1: The JavaScript example is correct, but you have to make sure that you only

How to get refresh token while using Google API JS Client

瘦欲@ 提交于 2019-11-29 04:04:59
I have been trying to implement an app that would need user to grant access to Google Analytics. I have been following this tutorial: https://developers.google.com/analytics/solutions/articles/hello-analytics-api And at some other places there is code for AngularJs which uses the same functionL https://gist.github.com/jakemmarsh/5809963 My problem is, that the auth works pretty well, but it does not return a refresh_token. It never returns a refresh_token. I have tried all the possible available on the web. 1. The first time, 2. Using prompt=force etc etc.. But nothing seems to return the

Google API authentication: Not valid origin for the client

独自空忆成欢 提交于 2019-11-28 22:23:32
When making an auth request to the Google API (gapi), it's returning false on the checkOrigin. I have removed any client id's or anything that would link directly to my account and replaced it with a regex indicating what the data is for reference. Url: https://accounts.google.com/o/oauth2/iframerpc?action=checkOrigin&origin=https%3A%2F%2Flocal.tools&client_id=(\d{21}) My origin url is a local url, which is https://local.tools Result: {valid: false} I'm using the example found here without deviation (except for replacing clientid with my 21 digit clientid): https://ga-dev-tools.appspot.com

How does Google's javascript API get around the cross-domain security in AJAX

一笑奈何 提交于 2019-11-28 19:41:42
How does Google's API make cross-domain requests back to Google, when it's on your website? They get around it by dynamically injecting script tags into the head of the document. The javascript that is sent down via this injection has a callback function in it that tells the script running in the page that it has loaded and the payload (data). The script can then remove the dynamically injected script tag and continue. The accepted answer is wrong. Ben is correct. Below is the actually iframe node pulled off a page using the Google API JavaScript Client . <iframe name="oauth2relay678" id=

Using Google Drive API + Parse to store files on a single Drive account

自古美人都是妖i 提交于 2019-11-28 13:06:54
I am trying to use a single Google Drive account as a 'web server.' I have an Android app that needs to be able to store and retrieve pictures. My idea was to use Parse to help manage everything and extend my storage capacity beyond Parse's free amount. Essentially, I will have a single Google Drive account and a Parse project. When a user wants to store a file, he/she uploads the file to Parse, Parse authenticates with the single Google Drive account (using CloudCode), Parse uploads the files to Drive, stores the URL to the file in a table, and deletes the file from Parse's cloud storage. I

How to get refresh token while using Google API JS Client

寵の児 提交于 2019-11-27 18:04:43
问题 I have been trying to implement an app that would need user to grant access to Google Analytics. I have been following this tutorial: https://developers.google.com/analytics/solutions/articles/hello-analytics-api And at some other places there is code for AngularJs which uses the same functionL https://gist.github.com/jakemmarsh/5809963 My problem is, that the auth works pretty well, but it does not return a refresh_token. It never returns a refresh_token. I have tried all the possible

Using Google Drive API + Parse to store files on a single Drive account

。_饼干妹妹 提交于 2019-11-27 07:29:34
问题 I am trying to use a single Google Drive account as a 'web server.' I have an Android app that needs to be able to store and retrieve pictures. My idea was to use Parse to help manage everything and extend my storage capacity beyond Parse's free amount. Essentially, I will have a single Google Drive account and a Parse project. When a user wants to store a file, he/she uploads the file to Parse, Parse authenticates with the single Google Drive account (using CloudCode), Parse uploads the

Google API authentication: Not valid origin for the client

我是研究僧i 提交于 2019-11-27 02:07:34
问题 When making an auth request to the Google API (gapi), it's returning false on the checkOrigin. I have removed any client id's or anything that would link directly to my account and replaced it with a regex indicating what the data is for reference. Url: https://accounts.google.com/o/oauth2/iframerpc?action=checkOrigin&origin=https%3A%2F%2Flocal.tools&client_id=(\d{21}) My origin url is a local url, which is https://local.tools Result: {valid: false} I'm using the example found here without