How to use gcalcli with your own Client ID and Secret

If you use gcalcli throughout the day, pretty soon you run into the Daily Limit Exceeded error. gcalcli is registered with Google API with a default Client ID and Client Secret and it has a limit of 100K requests per day. Because there are many gcalcli users, this limit gets over pretty easily and that causes the error.

Instead, you can use gcalcli as much as you want, if you authorize it to use your own Client ID and Secret. You can do this in just a few steps:

  1. Go to the Google APIs console:

  2. The GUI of this webpage has changed drastically recently and it redirects you to Google Cloud Console. I like to work with the old GUI. To do this, look for the Welcome to the new Google Cloud Console! Prefer the old console? message at the top. Choose the Go Back option there.

  3. You are now back in the old Google APIs webpage. Go to the API Access section. In the Client ID for web applications section, you can see your Client ID and Client Secret strings. These are the values you use later with gcalcli.

  4. gcalcli uses a localhost URI for its authentication. We need to add this to our API settings. To do this, click Edit Settings and in the Authorized Redirect URIs textbox add http://localhost:8080/ and click Update. We are done with mucking around in the Google APIs website now.

  5. At your terminal, we need to clean up the files used by gcalcli before we ask it to use our own Client ID and Secret. Delete the files ~/.gcalcli_oauth and ~/.gcalcli_cache.

  6. Run gcalcli with any command and provide your Client ID string to --client_id and your Client Secret string to --client_secret. For example:

$ gcalcli --client_id "" --client_secret "abcdefghijklmnopqrstuvwx" agenda

gcalcli now opens a request URI webpage in your browser and Google asks for your authorization. Authorize it and you are done. The required details are stored by gcalcli in its local files.

  1. From here on, just use the gcalcli command you want directly:
$ gcalcli agenda

You have a big limit of 100K requests per day to Google API, all for yourself! Enjoy🙂

Tried with: Ubuntu 12.04 LTS

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s