fbpx

403 User Rate Limit Exceeded Error | SOLUTION – Google Drive Fixed !

403 User Rate Limit Exceeded Error | SOLUTION – Google Drive Fixed !

If you are getting; googleapi User Rate Limit Exceeded,  gdrive 403 Rate Limit Exceeded we have a solution for you.

We have been using Gdrive to upload some of our essential files for many months. Recently, we noticed that our daily backup was not working as expected. Gdrive error logs show us, Failed to get file: googleapi: Error 403: Rate Limit Exceeded, rateLimitExceeded and Failed to get file: googleapi: Error 404: File not found: Failed., notFound errors.

 

We tried rebooting our servers refreshing our auth logins etc. none of them fixed our gdrive User Rate Limit Exceeded errors. The problem was an API related issue so we need to create a new API and build Gdrive from source. The solution is simple but takes times, If you are figuring out how to do it. However, It took a couple of our hours to do it but it will take minutes of your time, if you follow this guide you will solve your google drive 403 Rate Limit Exceeded error.

 

PS: We applied all the steps on our Centos server, but it will be the same with all platforms.

 

Part 1

Carefully follow the steps to fix google drive User Rate Limit Exceeded Error.

Downloading and Installing GO

You will need root privileges or sudo for ubuntu.

Download the files :

To download the Go binary on your linux server you can use wget or curl:

wget https://dl.google.com/go/go1.11.5.linux-amd64.tar.gz

You need to extract Go binary files from go1.11.5.linux-amd64.tar.gz After successful extraction; you will have a go named folder. You should move it to /usr/local location because it is recommended by publishers.

tar -xzf go1.11.5.linux-amd64.tar.gz
mv go /usr/local

 

Creating Workspace Folder for Go

For better-organized projects, create a projects folder with bin and src folder together in user home directory.

 

mkdir  -p ~/projectss/{bin,src}

 

Setting Environment Variables for Go

We need to set a $PATH Environment variable for Go to use it like any other commands in our UNIX system.

Create path.sh script in /etc/profile.d directory location

nano /etc/profile.d/path.sh

Add the following to the file, save and exit. (/etc/profile.d/path.sh)

/usr/local/go/bin

Additionally, we need to define GOPATH and GOBIN Go environment variables in the user’s  .bash_profile file to point to the recently created projects folder. GOPATH is our Go source files GOBIN is our compiled Go binary files. Open the .bash_profile file:

nano ~/.bash_profile

Append the following to the end of the file, save and exit: (~/.bash_profile)

export GOBIN="$HOME/projects/bin"
export GOPATH="$HOME/projects/src"

Apply to changes in our system; we need to update profiles with source command

 

source /etc/profile && source ~/.bash_profile

Let’s test our Go if it is working

[[email protected] ~]# go version 
go version go1.11.5 
linux/amd64

We needed to have Go in our system to compile Gdrive so that’s all for installing Go. We can continue Part 2 where we will compile Gdrive from source files.

Part 2

We will continue to solve googleapi 403 Rate Limit Exceeded error. Keep following the steps…

Creating Google API for Gdrive

If you see these errors while running Gdrive on your system:

Failed to get file: googleapi: Error 403: Rate Limit Exceeded, rateLimitExceeded

You need your own Google Drive API to use with Gdrive so you can get information from your usages. Google API’s provide  Quotas Information which is very helpful in our situation. We need to know if we Exceed our limits.

Visit https://console.developers.google.com/apis/dashboard

Top of the page, click Select a project then New Project. 

Fill Project name as you want it.

Google API New Project

 

Choose your newly created project at the top of the page. At the dashboard, click  ENABLE APIS AND SERVICES

It will redirect you API Library. Search Drive keyword and find Google Drive API. You need to enable Google Drive API to use it in your project.

 

Add and Enable Google Drive API

We successfully add Google Drive API in our project. Gdrive requries Google Drive API’s credentials. Let’s create one.

 

Google Drive API Credentials

Create Credentials Details and choose the option ” Help me choose.”

Google API Credentials

Choose the settings as I did:

Google API Credentials Settings

 

I filled Client Name as same as my API Name.

Google API Name

Next step, fill your mail address and write a Product name.

 

Google API OAuth Name

After that, It will give us the Credentials we need.

 

Google Drive Error 403 User Rate Limit Exceeded Solution

Click download and done.

It will download a JSON file which contains our Credentials for Gdrive. Open the client_id.json file with a text editor. Notepad++ is a good option.

You will see,

“client_id”:”205xxxxxxxxx-22imoxxxxxxxxxxxxxxxxpsm.apps.googleusercontent.com”

“client_secret”:”NxxxxxxG-4HxxxxxxxxxxxxxxxwZA”

We need that two value so note it.

 

Getting Source Files of Gdrive

We need Gdrive projects files from Github so that we can compile it with Go. Let’s download files into our ~/projects/ folder that we created earlier.

 

cd ~/projects/

Use GO to download Gdrive src files from GitHub.

 

go get github.com/prasmussen/gdrive

We need to change Credentials in handlers_drive.go where is located in the gdrive folder.

 

cd ~/projects/src/src/github.com/prasmussen/gdrive/

nano handlers_drive.go

const ClientId = "3671xxxxxxxxxxxxxxxxxxxxxxeg.apps.googleusercontent.com"
const ClientSecret = "1qsNxxxxxxxxhoO"

 

No More googleapi User Rate Limit Exceeded

Change ClientId and ClientSecret with your own Google Drive API Credentials form client_id.json 

Save and exit.

We are ready to build Gdrive.

Let’s build it:

 

cd ~/projects/src/src/github.com/prasmussen/gdrive/
go build

 

After the build, you will see gdrive executable file. Copy it to /usr/bin/ folder to use it.

 

cp gdrive /usr/bin/gdrive

 

Note: If you had gdrive on your system, you need to delete old token_v2.json.

 

cd ~/.gdrive

rm token_v2.json

Now, we have gdrive installed in our system with our Google Drive API settings.

Let’s test it.

 

gdrive list

 

If it is your first time to use Gdrive or deleted token file, Gdrive needs Authentication from you.

 

Authentication needed
Go to the following url in your browser:

Enter verification code:

Paste the link in your browser and get the verification code.

 

Execute gdrive list again

We Solved google drive 403 Rate Limit Exceeded

That is it is working without errors!

 

Let’s check if our API is working too.

Gdrive Quotas – gdrive User Rate Limit Exceeded

Yes ! it is working too. Now we can see our Quota limit.

For Windows, please check this: https://github.com/prasmussen/gdrive/issues/426#issue-404775200

If you have any question, please leave a comment below. We will answer them ASAP.

 

Thanks.

 

Leave a Reply

Your email address will not be published.