Securely Storing Google Colab Credentials

Created by Ben Deverman, Modified on Wed, 6 Mar at 1:21 AM by Alsabana Sahubarali

Google provides a Python development environment called Colab, which is available for PAD users and is easy to connect to BigQuery and other Google products. For many scripts, you’ll need to authenticate by providing credentials for other services, like BigQuery. We strongly, strongly advise storing credentials if you’re using them in a script (vs. including them in the script directly). 

To store credentials for a Colab script, you have a few options:

  1. Colab has integrations with GitHub and other Google APIs. With those integrations, you can input credentials into Google’s Secret Manager and pull them back in Colab. We recommend this approach - it’s more secure.
  2. Alternatively, you can upload a file with your credentials via the Colab UI. Note that you only need to store third-party credentials - you can access anything in Google Cloud via OAuth without any stored credentials.

To see the step-by-step process for using Google’s Secret Manager to store credentials, see this sample Colab notebook. If you try to run this notebook, it will fail until you change the project id and table name to your BigQuery project id and a table in your project. To run the notebook, you can hit "Cmd-F9" or select "Run All" from the "Runtime" menu.

For any additional questions on credential storage, please reach out to help@techallies.org.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article