Skip to content

HOWTO: Google calendar on headless system

Vadim Tkachenko edited this page Sep 26, 2023 · 5 revisions

Configuration

To find out how to configure this integration, jump here.

Technicalities

Google Calendar v3 API authentication requires you to start a browser on localhost, and make a callback request to an HTTP server it runs. Sometimes, it is not possible to start a browser on a headless system - either it is not powerful enough, or there's simply no X (and it is not yet known which of command line browsers is able to handle the Javascript on authentication callback pages, lynx is sure unable to do so).

Workaround

Headless

  1. Run a test case (GCalScheduleUpdaterTest) on a system where the browser is available. It will either spawn a browser, or at least will log the URL you need to visit.
  2. Visit the URL, provide the authorization.
  3. Copy the $HOME/.dz/calendar/StoredCredential to the headless system you need to run the scheduler on.

From this moment on, the authorization will be available on the target system until it expires. Currently, the expiration interval is set to one year, change the value in GCalScheduleUpdater if you think this is too short.

Raspberry Pi

Even on a headless system, you can still run a browser either via VNC, or via SSH with X11 forwarding enabled (ssh -X $host). Raspbian distributions up to Stretch used Midori Browser as a default - it doesn't work reliably with Google authentication. Replacing it with Chromium works:

sudo apt-get remove midori
sudo apt-get install chromium-browser