last day (16 days later) » 

1:49 PM
0
Q: Google Drive API returning 403 when trying to download file - no information about error given

SidnerSo, I have a ruby on rails project, I'm using the google-api gem and I'm trying to download a file from an account that I previously gave permission to my project to access and manage my google drive files. I have the refresh token and the access token and for some time, the download works fine. ...

 
Trace the http traffic and you will see additional information regarding the 403. While you are at it, double check that your http requests do indeed contain an access token as from memory, one possible cause of a 403 is a missing access token.
 
How am I supposed to do that if the traffic is all encrypted? I'm looking at the traffic on wireshark and I can't seem to find where the 403 is.
 
you need to enable logging in the SDK library. I don't use rails, so can't be more specific, but I'll have a google for you and post a comment if I find it.
 
Thanks for finding it, but I can't make it work. I put the line of code on the function that actually makes the connection and the first time I used it I got a middleware error of some sorts. I moved the line of code to the previous method and the error stopped, but there is nothing on the console or in any of the logs. :(
 
1:49 PM
That worked. :) Sad thing though: it shows the same thing as the response I posted above, after editing. Nothing more. =\ I am really at a loss here.
Thanks for all the help, though :) Really appreciate it. I don't really know what else to do...
 
2:00 PM
Can you think of anything else I can do? =\
 
2:54 PM
can you paste the request and response so I can see them. Don't **** anything out, just change a random couple of characters to obfuscate sensitive data
 
This is what is written into the log:
I, [2014-08-20T15:53:54.604091 #7469] INFO -- Status: 403
D, [2014-08-20T15:53:54.604386 #7469] DEBUG -- response: access-control-allow-origin: "*"
access-control-allow-credentials: "false"
access-control-allow-headers: "Accept, Accept-Language, Authorization, Cache-Control, Content-Disposition, Content-Encoding, Content-Language, Content-Length, Content-MD5, Content-Range, Content-Type, Date, GData-Version, Host, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, Origin, OriginToken, Pragma, Range, Slug, Transfer-Encoding, X-ClientDetails, X-GData-Client, X-GData-Key, X-Goog
Sorry, missed some lines:
I, [2014-08-20T15:53:54.219861 #7469] INFO -- : get https://doc-14-7g-docs.googleusercontent.com/docs/securesc/fstjjsryjsryjsyrjsyrs2bhh/l4jle2pj1opqhmveqkj1tk5eh0ufts76/1408456800000/13058000088843/15497975533171045268/0B8zm6xO0LrSpQThDVFFlTWdLMG8?e=download&gd=true&h=166530065626
D, [2014-08-20T15:53:54.219955 #7469] DEBUG -- request: User-Agent: "google-api-ruby-client/0.7.1 Linux/3.13.0-24-generic\n (gzip)"
Accept-Encoding: "gzip"
Content-Type: ""
Authorization: "Bearer ya29.ZwehehehAABl-PXo7hMgxU-d-frzG7vGvBcJaaaaaaKMON1gauwb598cMxO-9I8CAe3SM"
 
 
1 hour later…
4:24 PM
I went to my account, deauthorized my app and added it again. Tried to download file and this is what I got:
I, [2014-08-20T17:22:34.577388 #7469] INFO -- : get https://doc-14-7g-docs.googleusercontent.com/docs/securesc/fj4b9dsh22222ethqaa3s2bhh/03q4o2222rhwhk9p9imgah39/1408550400000/13058876669334088843/154979755332222
Accept-Encoding: "gzip"
Content-Type: ""
Authorization: "Bearer ya29.ZwBwqehwehwethwethwethwethwethCz_ICPV5ZXHQ1TbXyehgethrR03V2Bx1GHFrJQ"
Cache-Control: "no-store"
I, [2014-08-20T17:22:35.690497 #7469] INFO -- Status: 200
D, [2014-08-20T17:22:35.690845 #7469] DEBUG -- response: access-control-allow-origin: "*"
 

  last day (16 days later) »