Reputation: 131
I am building a form where a user can upload a file from Google Drive. I have the client ids (both free and paid account). I am using the Google Drive API and tried to download the excel, document and other types of files. Earlier the file.get service was giving me the result, but suddenly it stopped giving results (for sheets and documents only.. for other types of files I can see the proper response from the API). I am getting the following message every time.
Daily Limit for Unauthenticated Use Exceed. Continue use require signup.
Though I am writing the code in Drupal using httpClient service, I have tried it with curl as well. Here is the sample code:
// $url is the response from Drive Picker API.
list($id, $orignal_name, $google_token) = explode('@@@', $url);
$headers = [
'Authorization' => 'Bearer ' . $google_token,
]';
$crl = curl_init();
$setopt_array = array(CURLOPT_URL => $remote_url, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => $headers);
curl_setopt_array($crl, $setopt_array);
$response = curl_exec($crl);
curl_close($crl);
I couldn't figure out what the message is about. Is it about the free account? If so, I have tried with a paid account (credit card linked to it.)
If it is about domain verification, I did a trick, first I verified a working domain and used the domain name on my local website using the proxy settings.
I know I have to use 'file.export' API to download the file, but I need file.get to get the mimeType of the file. I need to know what is the exact reason behind the issue so I can download the file using Google Drive API.
Upvotes: 1
Views: 189
Reputation: 22306
This question has been answered many times on SO.
The error is saying that you haven't provided an http Authorization
header with your Drive request. This is caused by a bug in your code.
Upvotes: 1