Set up Google access

A site kept in Google Drive is read and written by SeedPage as you: with your Google sign-in, through your own Google Cloud project. No service of SeedPage sits between your computer and Drive, and Drive's sharing decides what each person may see and change. Setting this up is done once per installation, by an administrator, and takes about fifteen minutes. Sites on this computer or on GitHub need none of it.

Why a project of your own

  • Your sites' pages and settings never pass through anyone else's servers or accounts.
  • The limits Google sets on reads and writes are yours alone, not shared with every SeedPage installation.
  • If SeedPage stopped existing tomorrow, your access to your sites would not change.

Before you start

  • A Google account: a Google Workspace account of your company, or a personal Gmail.
  • SeedPage installed on this computer.

Create the project and turn on the APIs

  1. Open console.cloud.google.com and sign in. The first time, accept Google Cloud's terms. No payment card is needed.

  2. In the project picker at the top, choose New project. Give it a name, such as SeedPage, and Create. Make sure it is the project selected at the top.

  3. Open the menu, APIs and services, Library. Search for Google Drive API, open it and choose Enable. Do the same for Google Docs API and Google Sheets API.

The consent screen is what Google shows when someone signs in to SeedPage: the name of the app and what it asks for.

  1. In APIs and services, open OAuth consent screen and choose Get started.

  2. App name: SeedPage, or your company's name for it. User support email: yours. Next.

  3. Audience: Internal if you are on Google Workspace and only people of your organization will sign in. External on a personal Gmail, or to let people outside the organization in. Next.

  4. Contact information: your e-mail. Next, accept the policy, and Create.

  5. External only: open Audience, and under Publishing status choose Publish app, then Confirm. Do not ask for verification.

What each choice means:

  • Internal: no warning when people sign in, and sign-ins do not expire.
  • External, published: the first time each person signs in, Google says it has not verified the app. They choose Advanced, then Go to SeedPage. Up to 100 people can sign in this way, which is plenty for a team. Your project is the app, so the warning is about your own project.
  • External, left in Testing: only the test users you list may sign in, and every sign-in expires after 7 days. Avoid it.

The client

The client is what tells Google that a sign-in comes from SeedPage on your project.

  1. In the consent screen's pages, open Clients and choose Create client.

  2. Application type: Desktop app. Name: SeedPage. Create.

  3. Download the JSON file it offers. Its name starts with client_secret_.

  4. In a terminal, in the SeedPage folder, give it to SeedPage. It is copied to SeedPage home as google-client.json, and the downloaded file can be deleted.

Terminal
npm run google -- client --file ~/Downloads/client_secret_….json

Sign in

Each person signs in with their own Google account. In the list of sites, Sign in with Google opens Google's page in the browser; or, in a terminal:

Terminal
npm run google -- login

Choose the account, allow SeedPage to see and change Drive files, Docs and Sheets, and the page says you can close it. The sign-in is kept in SeedPage home as google-user.json, readable only by you. To see how SeedPage reaches Google:

Terminal
npm run google -- status

SeedPage asks for all of Drive because a site is a folder of Docs, Sheets and images that people also make and change in Drive itself. It only opens the sites in its list.

A team

Give the client file to everyone who will edit the sites, on their own computer: each runs the client command with it, then signs in with their own account. A Desktop app's client is not a secret for Google; what protects the sites is each person's sign-in and Drive's sharing. Share the site's folder in Drive with each of them: Editor to change pages, Viewer to only read.

Signing out

  • On this computer: delete google-user.json from SeedPage home. SeedPage then asks to sign in again.
  • Everywhere: in your Google account, Security, Your connections to third-party apps and services, choose SeedPage and remove its access. Every sign-in made with it stops working.

Publishing from CI

A build on GitHub Actions cannot sign in as a person. It reads the site with a service account of the same project instead, read-only and without a key file: see Publishing from CI.

When something goes wrong

  • "The Google client file was not found": the client step was not done on this computer. Run it with the downloaded file.
  • "Google no longer accepts the sign-in": it expired (an External app left in Testing), or access was removed from the Google account. Sign in again.
  • Access blocked, or the app is not allowed: an Internal app and an account outside the organization, or an External app in Testing and an account not in its test users.
  • An API has not been used in this project or is disabled: turn on the API the message names, and wait a minute.
  • "Google asked SeedPage to slow down": too many reads in a minute, usually the first build of a large site. SeedPage waits and goes on by itself.