Not able to download file from google drive - google-api

We are using google drive api to download the content, which was working fine from last 2 years, Now we started facing below error:
Error 403 (Forbidden)!!1
403 Forbidden
Your client does not have permission.
steps to reproduce:
Get API:
https://content.googleapis.com/drive/v2/files/<FILE_ID>?alt=media&source=downloadUrl
Headers : Authorization: Bearer <token>
Content created on google drive is getting downloaded, while content uploaded to drive from the local machine is not getting downloaded via API.
Any help would be appreciated. We have scope drive.readonly granted.

I had the same issue, an application we had running for years suddenly stopped working in mid-March of this year. I found the solution in this post.
In summary, the download url returned (content.googleapis.com/drive/v2/files/FileID?alt=media) no longer works. Instead use this url - googleapis.com/drive/v2/files/FileID?alt=media

Related

Go gmail api quickstart results in localhost refused to connect ERR_CONNECTION_REFUSED

I'm following the steps in go quickstart gmail api.
On the function getTokenFromWeb, pasting either the long url
https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=abcdefg.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.readonly&state=state-token
or
http://localhost:8000
results in
This site can't be reached. localhost refused to connect. ERR_CONNECTION_REFUSED
Following the same quickstart but for python works flawlessly.
If I get the token via python and use it in Go quickstart, it also works. So the issue is just on the token from web retrieval.
The issue you are having is related to the removal of oob. When that sample was originally created oob still worked. So it would display a nice web page for you where you could copy the authorization code.
That no longer works so we are forced to use http://127.0.0.1 or localhost. As your machine apparently does not have a web server running its displaying to you a 404 error.
However if you look in the URL bar you will find the authorization code you need in order to authorize your application.
The solution is to simply copy the code from the url bar. If you want to fix the 404 your going to have to figure out how to start a web server in order to host the http://127.0.0.1 from.
The python sample does this by running a local server
creds = flow.run_local_server(port=0)
Php can do it using something like this
php -S localhost:8000 -t examples/
Im not sure how that can be done with Go though.

Forbidden 403 Access URL API in Laravel

Good afternoon, let me ask
I created a service API using Laravel, but one of the API urls when I sent the response parameter was 403 or Forbidden. even though before it was fine, it worked smoothly. And I raised it to the server instead it became Forbide. Anyone know why? thank you for answering
If it is ok on local and getting a forbidden error on the server, the problem might be caused by the webserver application. please take a look at this link.

The HTTP verb POST used to access path '/UploadedImages' is not allowed."

Testing Fine-Uploader and get the following trying to upload images. It's on a testbox and I have rights to the folder. I am not running under IIS as most of these errors when searching google have to do with IIS. Any ideas.
I am using asp.net / c# and I am not using URL Rewriting.
The error suggests that the "/UploadImages" endpoint is not configured to accept POST requests (probably only GET requests). You'll need to update your server configuration appropriately so that POST requests are accepted.

How to resolve CORS error with GoogleCast sample hosted on Google drive?

I'm new to Chromecast/Web dev, but I downloaded and loaded the "Cast-Player-Sample" from github here to my Google Drive, then published the public URL in my developer account. I also associated my devices/serials/rebooted. I'm receiving this error in the console:
The page at 'https://www.googledrive.com/host/[REDACTED]/player.html'
was loaded over HTTPS, but ran insecure content from
'ws://localhost:8008/v2/ipc': this content should also be loaded over
HTTPS.
Everything I read says it's a CORS issue and that Google drive doesn't allow Access-Control-Allow-Origin: * because someone could steal all of your drive-data, which makes sense.
How can I resolve this error?
Screenshot:
The error I see in console has a wrong url for your player.html; did you host that correctly on Google drive (see instructions here) and when you registered your app? URL should look like https://www.googledrive.com/host/some_doc_id

SSL Certificate Match Error while calling Google Places API

I have been using Google Places API inside my application. The client code is written in Java. It was working fine till couple of weeks ago and suddenly it started throwing following exceptions while making API call:
javax.net.ssl.SSLException: hostname in certificate didn't match: <maps.googleapis.com/209.85.175.95> != <*.googleapis.com> OR <googleapis.com> OR <*.googleapis.com>
I am using following URL for making API call : https://maps.googleapis.com/maps/api/place/search/json?
Also tried with different Google API keys generated from Google API console.
Can someone please point what I am missing here?
Many thanks
I used the latest Google API (version 1.13.2) which support better SSL options:
ApacheHttpTransport.Builder transport = new ApacheHttpTransport.Builder().doNotValidateCertificate().build();

Resources