Last Updated: March 2023
IMPORTANT: Ignore the out-of-date steps below for getting Chromium keys.
Instead, read this up-to-date guide (Jan 2023) written by @LearningToPi.
P.S. Thank you to every contributor below who provided tips over the years on what should be a straightforward process: setting up Chromium for local development.
Long live the web!
Sometimes you need to use API Keys to use things like the Speech API. And then you Google a bit and follow all the instructions. But the Chromium Project's API Keys page does a not-so-great of explaining how to do this, so I will.
- Download Chromium.
- You'll notice a yellow disclaimer message appear as a doorhanger:
Google API Keys are missing. Some functionality of Chromium will be disabled.
Learn More
. - Clicking on that link takes you to the confusing API Keys docs page.
- If you aren't already, subscribe to the chromium-dev@chromium.org mailing list. (You can just subscribe to the list and choose to not receive any mail. FYI: the Chromium project restricts the APIs to those subscribed to that group - that is, Chromium devs.)
- Make sure you are logged in with the Google account associated with the email address that you used to subscribe to chromium-dev.
- Log in to the Google Cloud Platform, and select an existing project or press the "Create Project" button.
- From the project's API Manager, select the Credentials tab in the sidebar.
- Create a Browser API Key.
- You'll see a modal with an API key. Copy and paste that somewhere.
- Now create an OAuth Client ID.
- After you complete all the steps and the "content screen," you'll be presented with a modal with your Google Client ID and Client Secret.
- You'll need to set three environment variables:
On Windows:
Launch cmd.exe
and enter the following commands:
setx GOOGLE_API_KEY your_key_goes_here
setx GOOGLE_DEFAULT_CLIENT_ID your_client_id_goes_here
setx GOOGLE_DEFAULT_CLIENT_SECRET your_client_secret_goes_here
On Mac OS X / Linux:
Plop these in your ~/.profile
file:
export GOOGLE_API_KEY="your_key_goes_here"
export GOOGLE_DEFAULT_CLIENT_ID="your_client_id_goes_here"
export GOOGLE_DEFAULT_CLIENT_SECRET="your_client_secret_goes_here"
-
Now launch Chromium:
On Windows: Launch Chromium normally.
On Mac OS X:
/Applications/Chromium.app/Contents/MacOS/Chromium
In Arch-based Linux distributions, Chromium and Chromium-Dev are using a special launcher that parses a configuration file for additional options.
It is ~./config/chromium-flags.conf for Chromium, and ~/.config/chromium-dev-flags.conf for Chromium-Dev. For the information discussed here, just insert the following lines into that file:
--user-agent="Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36"
--oauth2-client-id=xxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com
--oauth2-client-secret=xxxxxxxxxxxxxxxxxxx
Of course, replace those xxx by your actual data.
Unfortunately, I did not find an option to insert the API Key there as well, so it looks like in Arch and Manjaro, you will have to amend /etc/environment to include
GOOGLE_API_KEY=xxxxxxxxxxxxxxxxxxx