Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't retrieve file meta data from Google Drive, 404
    primarykey
    data
    text
    <p>I'm having some seriously weird issues with the Google Drive API. </p> <p>Bear with me here, there's a lot to explain. </p> <p>I originally got the API working using one of my Google accounts -- let's call it <code>test@google.com</code> for simplicity. I got the Google Picker UI working and it correctly displays the list of files in my Drive account.</p> <p>I set it to my APP_ID and I have some server-side logic that uses the official <code>google-ruby-api-client</code> gem to connect to the Drive API using the <code>drive.files.get</code> endpoint. I can then download the file's metadata using this snippet:</p> <pre><code>require 'google/api_client' client = Google::APIClient.new # client ID and secret from Google APIs Console client.authorization.client_id = "{CLIENT_ID}" client.authorization.client_secret = "{SECRET}" client.authorization.redirect_uri = "http://myapp.com/users/auth/gdrive" # access token stored in database from oauth2 flow client.authorization.access_token = "TOKEN" client.authorization.scope = [ "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile" ] result = client.execute!( :api_method =&gt; 'drive.files.get', :version =&gt; 'v2', :parameters =&gt; { 'fileId' =&gt; params[:file_id] }) </code></pre> <p>With the <code>test@google.com</code> account I tried this on, the result comes back with the file's metadata, and I'm able to download the file. All peachy.</p> <p>The problem comes when I use a <em>different</em> Google account. I can access the files in Picker, but when the request is sent to the server with the <code>fileId</code> using the above, I just keep getting a 404 error, saying that the file doesn't exist. I've also tried to access the file's metadata using the OAuth 2.0 Playground provided by google, but the weird thing is that I still get that error, but I also get the same 404 error when I use the <code>test@google.com</code> account.</p> <p>The only thing I can really think of is that I submitted a version of my app with all the Google Drive details once, and installed the app via the Chrome Webstore. After I realized it was showing up for everyone as a Drive-enabled app, I promptly removed it and changed the manifest.json file back to its normal, non-Drive enabled state. I did read that you should have the app installed via the Chrome Webstore to work properly, but I also read that that's not the case anymore. Are your installed Chrome Webstore apps stored in Google's cloud somewhere so they know that it was installed for a particular account? Or are webstore apps just installed locally? I'm so confused.</p> <p>What am I missing here? I haven't been this frustrated with an API in a really long time. Please help!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload