Skip to content

Sign-in

Lyra needs at least one way for people to sign in. You choose which ones your server offers with settings in deploy/.env, and you can turn on as many as you like. Every method that proves the same email address reaches the same account, so someone can sign in with Google one day and an emailed link the next.

Method Turned on by Needs
Emailed sign-in links SMTP_URL or SES_REGION A mail server, or Amazon SES
Email and password On by default once Lyra can send email A mail server, or Amazon SES
Google GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET An OAuth client in Google Cloud
Single sign-on OIDC_ISSUER_URL, OIDC_CLIENT_ID and OIDC_CLIENT_SECRET Okta, Entra ID, Authentik or any other OpenID Connect provider
Sign in with Apple The four APPLE_ settings An Apple Developer account

After changing any of these, run docker compose up -d in the deploy folder.

By default, anyone who can sign in can create an account and an organization, and becomes that organization’s admin. To keep strangers out of a server anyone can reach, set SIGN_UP_EMAIL_DOMAINS to your email domains, separated by commas:

Terminal window
SIGN_UP_EMAIL_DOMAINS=acme.com,acme.co.uk

Then only people with an email at those domains can create an account or an organization. Anyone else can sign in only once someone has shared a page with them or invited them to an organization.

People join an organization in one of three ways:

Way What happens
An admin invites them Under Settings → People, an admin invites someone by email as an admin or a member. The invite lasts 14 days and gives a link to send them. They join when they sign in with that email
Their email domain is verified Under Settings → Email domains, an admin adds a domain and Lyra shows a DNS TXT record to create on _lyra-verification.<domain>. Once Verify finds it, everyone with an email at that domain joins as a member when they sign in. Only one organization can verify a domain
Someone shares a page with them They join as a member if their email is on a verified domain, and as a guest otherwise. Guests only ever see pages shared with them

Everyone else sees a screen to create their own organization, and can open pages shared with them as a guest. Someone an admin removed doesn’t join again through the domain until an admin invites them.

People type their email and get a link that signs them in. The link lasts 15 minutes and works once. It opens a page with a Continue button, so a mail scanner that opens every link in an email can’t use it up first. Lyra sends its notification emails, such as mentions and invites, the same way.

Use a mail server (SMTP) or Amazon SES, not both:

Setting What to put
SMTP_URL The mail server as a URL, like smtps://lyra%40acme.com:password@smtp.acme.com:465. Characters like @, : and / in the user name or password are written as %40, %3A and %2F
SES_REGION Instead of SMTP_URL: send through Amazon SES’s API in this region, like eu-west-1. Credentials come from AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY, or the machine’s role, which needs ses:SendEmail for EMAIL_FROM
SES_FROM_IDENTITY_ARN Optional: when EMAIL_FROM’s domain is set up for SES in another AWS account, the ARN of that identity. Its owner must let this account send through it
EMAIL_FROM Who the emails come from, like Lyra <lyra@acme.com>

Lyra only sends to an smtp:// server on another machine over STARTTLS, so the mail server’s password and the emails are never sent unencrypted. Add ?requireTLS=false to the end of SMTP_URL to allow sending without it. smtps:// servers always use TLS.

To stop anyone using sign-in emails to flood an inbox, each email address can ask for 5 links a minute and 10 an hour, and each network address for 30 every 10 minutes. SIGN_IN_LINKS_PER_IP changes the second number, which also applies, separately, to sign-up and password reset emails. It also limits how many of each kind of link one network address can open in 10 minutes.

People can also create an account with an email and a password. It’s on by default, but only works when Lyra can send email (SMTP_URL or SES_REGION), because each new account confirms its email first. Set PASSWORD_SIGN_IN=false to turn it off.

Confirming the email The account and its password are only made once the email is confirmed, through a link that lasts 24 hours
Length 10 to 200 characters
Breached passwords Refused when Have I Been Pwned lists them. Lyra sends only the first five characters of the password’s SHA-1 hash, never the password, and allows the password when the service doesn’t answer within 2 seconds. Set PWNED_PASSWORDS_URL empty to turn the check off
Wrong passwords After 5 wrong passwords within an hour for one email, sign-in for that email waits 30 seconds, doubling up to 15 minutes. Nothing locks an account for good
Forgotten passwords A reset link lasts an hour and works once. Resetting or changing a password signs out every other session, and Lyra emails the person that their password changed. A reset also revokes all their API tokens and connected AI apps

People who signed up with Google, Apple, single sign-on or links can add a password later: Settings → Account emails them a link to set one.

  1. In Google Cloud, create an OAuth client of the type Web application.
  2. Add the redirect URI https://docs.acme.com/api/auth/google/callback, with your own domain.
  3. Put its id and secret in GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET.

Lyra works with any provider that speaks OpenID Connect, such as Okta, Microsoft Entra ID or Authentik.

  1. In your provider, create an application for Lyra with the redirect URI https://docs.acme.com/api/auth/oidc/callback.

  2. Set all three of these, or none:

    Setting What to put
    OIDC_ISSUER_URL The provider’s issuer address. Lyra reads the rest of its details from there
    OIDC_CLIENT_ID The application’s client id
    OIDC_CLIENT_SECRET The application’s client secret
  3. Optional: set OIDC_LABEL to the button’s text, up to 60 characters. The default is Sign in with SSO.

Single sign-on lets in everyone the provider signs in. To keep people out, limit who can use the application in your provider, or set SIGN_UP_EMAIL_DOMAINS.

  1. In your Apple Developer account, create a Services ID with Sign in with Apple turned on, the domain docs.acme.com and the return URL https://docs.acme.com/api/auth/apple/callback.

  2. Create a key with Sign in with Apple turned on, and download its .p8 file.

  3. Set all four of these, or none:

    Setting What to put
    APPLE_CLIENT_ID The Services ID
    APPLE_TEAM_ID Your Apple Developer team ID
    APPLE_KEY_ID The key’s id
    APPLE_PRIVATE_KEY The contents of the .p8 file, starting with -----BEGIN PRIVATE KEY-----. It can be on one line, with \n between its lines

Apple sends the person’s name only the first time they sign in, and their email may be a Hide My Email address.