Skip to content

Instantly share code, notes, and snippets.

@cvan
Last active March 19, 2024 10:44
Show Gist options
  • Save cvan/44a6d60457b20133191bd7b104f9dcc4 to your computer and use it in GitHub Desktop.
Save cvan/44a6d60457b20133191bd7b104f9dcc4 to your computer and use it in GitHub Desktop.
Launch Chromium with API Keys on Mac OS X and Windows

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.

  1. Download Chromium.
  2. 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.
  3. Clicking on that link takes you to the confusing API Keys docs page.
  4. 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.)
  5. Make sure you are logged in with the Google account associated with the email address that you used to subscribe to chromium-dev.
  6. Log in to the Google Cloud Platform, and select an existing project or press the "Create Project" button.
  7. From the project's API Manager, select the Credentials tab in the sidebar.
  8. Create a Browser API Key.
  9. You'll see a modal with an API key. Copy and paste that somewhere.
  10. Now create an OAuth Client ID.
  11. 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.
  12. 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"
  1. Now launch Chromium:

    On Windows: Launch Chromium normally.

    On Mac OS X:

    /Applications/Chromium.app/Contents/MacOS/Chromium
@TheBlindedBoy
Copy link

Did the steps. Just as obayit said just join: test accounts group. Thanks so much everyone.

@AlexeyBalin
Copy link

Thanks, OAuth 2.0 Client IDs with type "TV client" works for me!

@umueller459
Copy link

umueller459 commented Jan 28, 2022

https://groups.google.com/u/0/a/chromium.org/g/google-browser-signin-testaccounts
(For this you cannot see any content. It is OK. Just join - all OK)

https://groups.google.com/a/chromium.org/forum/?fromgroups#!forum/chromium-dev
(Tip: Unsubscribe from emails. You do not need to see those emails)

https://console.cloud.google.com/apis/api/chromesync.googleapis.com
(For this press, Enable button)

Just approve these 3 in the given order. Get the API keys as given below and setup your environment. Just Works...

@rudolfschmidt
Copy link

After putting the variables I can click the sync button but after clicking I get in the console:
[20103:20103:0201/125522.340482:ERROR:dice_turn_sync_on_helper.cc(226)] Cannot turn Sync On for invalid account.
Any idea?

@umueller459
Copy link

umueller459 commented Feb 1, 2022

Cannot turn Sync On for invalid account.

That means you need to click on each of these google links and SUBCRIBE. For the last one ENABLE...

https://groups.google.com/u/0/a/chromium.org/g/google-browser-signin-testaccounts
(For this you cannot see any content. It is OK. Just join - all OK)
https://groups.google.com/a/chromium.org/forum/?fromgroups#!forum/chromium-dev
https://console.cloud.google.com/apis/api/chromesync.googleapis.com

@belr20
Copy link

belr20 commented Feb 18, 2022

This works fine for my BunsenLabs Lithium distro, a derivative from Debian 10 Buster 👌 Many thanks 🙏

@rudolfschmidt
Copy link

rudolfschmidt commented Feb 23, 2022

At https://groups.google.com/u/0/a/chromium.org/g/google-browser-signin-testaccounts I get the note that I cannot see the content because of missing permission and that I have to contact the group admin. Any idea?

Edit:
I created a new config directory and the syn works but how to use my old data to be synced? If I use my current config folder, the sync is not kicked in

@umueller459
Copy link

I get the note that I cannot see the content because of missing permission and that I have to contact the group admin. Any idea?

You will NOT see anything. It is all OK. It is like that (it is just a group to join)...

If I use my current config folder, the sync is not kicked in

Turn off and ON sync. Click on the right side top icon of you name and login. All should work.

@KhashayarDanesh
Copy link

Hello All,

I'm doing the setup on a mac, and global imports don't work on mac as they should on a normal unix system, so I thought I could prevent some headaches:

/etc/default or ~/.profile variable imports are not passed to applications ran with spotlight or aqua/finder, so you should pass the variables to launchd to be able to inherit variables within applications ran with aqua/finder/spotlight.

You have multiple ways of setting global variables using launchd:

  1. Setting environment variables using a launchd unit : see the link

  2. You can add global variables to launchd within your shell's .profile or /etc/default with adding the following lines:

GOOGLE_API_KEY=""
GOOGLE_DEFAULT_CLIENT_ID="client_id_you_saw_under_oauth"
GOOGLE_DEFAULT_CLIENT_SECRET="client_secret_you_saw_under_oauth"

launchctl setenv GOOGLE_API_KEY $GOOGLE_API_KEY
launchctl setenv GOOGLE_DEFAULT_CLIENT_ID $GOOGLE_DEFAULT_CLIENT_ID
launchctl setenv GOOGLE_DEFAULT_CLIENT_SECRET $GOOGLE_DEFAULT_CLIENT_SECRET

@LearningToPi
Copy link

After spending a LOT of time searching the internet I found this thread very helpful but didn't fill in all the blanks for me. I wrote a complete step-by-step tutorial to setup Chromium with chrome-sync on a Radxa Rock5B running Ubuntu 20.04 LTS. https://www.learningtopi.com/sbc/chromium-sync/. Hope this helps anyone else that stumbles onto this thread!

@leandroknorre
Copy link

After spending a LOT of time searching the internet I found this thread very helpful but didn't fill in all the blanks for me. I wrote a complete step-by-step tutorial to setup Chromium with chrome-sync on a Radxa Rock5B running Ubuntu 20.04 LTS. https://www.learningtopi.com/sbc/chromium-sync/. Hope this helps anyone else that stumbles onto this thread!

IT WORKS!! Thank you. I've been able to sync up my Antix22 32-bit chromium

@Uugsx
Copy link

Uugsx commented Mar 30, 2023

After spending a LOT of time searching the internet I found this thread very helpful but didn't fill in all the blanks for me. I wrote a complete step-by-step tutorial to setup Chromium with chrome-sync on a Radxa Rock5B running Ubuntu 20.04 LTS. https://www.learningtopi.com/sbc/chromium-sync/. Hope this helps anyone else that stumbles onto this thread!

IT WORKS!! Thank you. I've been able to sync up my Antix22 32-bit chromium

In LMDE 5, I save variables

GOOGLE_DEFAULT_CLIENT_SECRET=
GOOGLE_DEFAULT_CLIENT_ID=
GOOGLE_API_KEY=

in /home/test/.config/environment.d , file 50-chrome-sync.conf

I restart my PC, but nothing happens, why is this?

it is possible to run with chrome synchronization only from the terminal

export GOOGLE_DEFAULT_CLIENT_SECRET=XXXXXXX
export GOOGLE_DEFAULT_CLIENT_ID=XXXXXXXXXXXX
export GOOGLE_API_KEY=XXXXXXXXXXXX
chromium

help me to understand the reason

@umueller459
Copy link

After spending a LOT of time searching the internet I found this thread very helpful but didn't fill in all the blanks for me. I wrote a complete step-by-step tutorial to setup Chromium with chrome-sync on a Radxa Rock5B running Ubuntu 20.04 LTS. https://www.learningtopi.com/sbc/chromium-sync/. Hope this helps anyone else that stumbles onto this thread!

IT WORKS!! Thank you. I've been able to sync up my Antix22 32-bit chromium

In LMDE 5, I save variables

GOOGLE_DEFAULT_CLIENT_SECRET= GOOGLE_DEFAULT_CLIENT_ID= GOOGLE_API_KEY=

in /home/test/.config/environment.d , file 50-chrome-sync.conf

I restart my PC, but nothing happens, why is this?

it is possible to run with chrome synchronization only from the terminal

export GOOGLE_DEFAULT_CLIENT_SECRET=XXXXXXX export GOOGLE_DEFAULT_CLIENT_ID=XXXXXXXXXXXX export GOOGLE_API_KEY=XXXXXXXXXXXX chromium

help me to understand the reason

Ask LMDE devs how is the SHELL working. In many linux distros, add the values to $HOME/.profile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment