Guides

Sign in with a provider

Let people into the admin through Google, Microsoft, GitHub, any OpenID Connect provider or Cloudflare Access, with passkeys or without them.

Sign in with a provider

People sign in to the admin with a passkey unless you say otherwise. A deployment can also let them in through an account they already have: Google, Microsoft, GitHub, any OpenID Connect provider, or Cloudflare Access. Passkeys stay on beside them, or you turn them off.

Configure the providers

The providers belong to the Worker, not to a site: list them in src/worker.ts, then deploy.

import { createHollware } from '@hollware/server'

const hollware = createHollware({
  auth: {
    providers: [
      { kind: 'google', clientId: '1234.apps.googleusercontent.com', clientSecret: 'GOOGLE_CLIENT_SECRET' },
      { kind: 'microsoft', tenant: 'example.com', clientId: '00000000-0000-0000-0000-000000000000', clientSecret: 'MICROSOFT_CLIENT_SECRET' },
    ],
    passkeys: true,
  },
})

clientSecret is the name of a Worker secret, never the secret itself. Set it on the deployed Worker, and in .dev.vars for the local server:

npx wrangler secret put GOOGLE_CLIENT_SECRET

A name that starts with HOLLWARE_, CLOUDFLARE_ or CF_ is refused. npx hollware doctor names each secret of a provider that neither .dev.vars nor vars sets.

When you register the app with the provider, give it this redirect URI, with the public URL of your Hollware and the id of the provider:

https://cms.example.com/auth/federate/google/callback

The sign-in page lists the providers in the order of the config. With passkeys: false and one provider, /signin goes straight to it. passkeys: false with no provider stops the Worker at startup, since nobody could sign in.

The providers

kindIt needsIts email counts as verified when
googleclientId, clientSecretGoogle says so (email_verified)
microsofttenant, clientId, clientSecretalways: the tenant is one directory
githubclientId, clientSecretit is the primary address, and GitHub verified it
oidcid, name, issuer, clientId, clientSecret, and scopes if you want othersthe provider says so (email_verified)
cloudflare-accessteamDomain, audiencealways
  • Microsoft. tenant is the id (a GUID) or the domain of your own Microsoft Entra directory. common, organizations and consumers are refused: they let in accounts of any directory, whose email nobody verified for you.
  • OpenID Connect. issuer is an https:// URL, as the provider documents it. Hollware reads its /.well-known/openid-configuration, and refuses a document that names another issuer. name is what the sign-in page shows, and id is part of the redirect URI. scopes are openid email profile unless you list others, and always include openid.
  • Cloudflare Access. teamDomain is your Zero Trust team domain, such as example.cloudflareaccess.com, and audience the Application Audience (AUD) tag of the Access application in front of your Hollware. Hollware reads the token Access adds (Cf-Access-Jwt-Assertion) on /signin and on /auth/federate/cloudflare-access, checks it against the keys of your team domain and the tag, and signs the person in with no page of its own. An application that covers those paths leaves /mcp and /v1 to their tokens.

Google, Microsoft, GitHub and Cloudflare Access take their kind as their id. Give id to two providers of one kind, such as two Microsoft directories.

Who gets in

Hollware knows an account of a provider by its provider and its subject, the id the provider gives it, never by its email. The first time an account signs in, Hollware links it by its verified email to:

  1. the person of the deployment who has that address; or
  2. an invitation sent to that address, which it accepts; or
  3. a site whose access.autoProvision lets in that address or its domain: the account becomes a new member of it.

Otherwise the page answers No access, and asks for an invitation to the address of the account. An email the provider did not verify links nothing: such an account signs in only once it is linked. Every later sign-in with a verified email also accepts the invitations that wait for that address.

Invite by email

In the admin, under People, give the invitation an Email. From the command line:

npx hollware invite --role author --email ada@example.com --remote

Signing in through a provider with that verified address accepts the invitation, with or without its link. The link still sets up a passkey, once, within seven days unless you give --days.

Every invitation names an address, so a person who set up a passkey keeps one. Once the deployment lists a provider, signing in through it with that verified address reaches the same person, with their passkeys and their sites.

The first owner's address comes from hollware init --owner-email ada@example.com, or npm create hollware -- --owner-email ada@example.com, which both ask for it. You vouch for that address, so it counts as verified.

Let a domain in

An owner lets people in without an invitation, site by site: in the admin under Site, in Sign-in, or in the definition of the site over MCP (update_site):

"access": {
  "autoProvision": { "domains": ["example.com"], "emails": ["ada@partner.org"], "role": "author" }
}

A verified email of one of domains, exactly as it follows the @ (subdomains are not included), or one of emails, becomes a member with role the first time it signs in: author, the default, or editor. Only another owner ever makes an owner. autoProvision: null, the default, lets nobody in this way.

Passkeys and accounts together

Under Account, each person sees the accounts of providers that sign them in, and adds a passkey with Add a passkey. A person removes their last passkey only once an account of a provider has signed them in; without one, the last passkey stays.

With passkeys: false, nobody sets up a passkey: /setup shows a page that tells people to open /signin and continue with the account of the address their invitation names.

A new project

npm create hollware takes the provider as options:

npm create hollware my-cms -- --auth google --client-id 1234.apps.googleusercontent.com --owner-email ada@example.com

--auth is google, microsoft, github, oidc or cloudflare-access. microsoft also needs --tenant, oidc needs --issuer, and cloudflare-access needs --team-domain and --audience instead of --client-id. The client secret is the Worker secret <KIND>_CLIENT_SECRET, such as GOOGLE_CLIENT_SECRET: the command says to put it in .dev.vars, and to set it with wrangler secret put before you deploy.

Every sign-in is a line of the activity log, with the provider it came through.