Skip to content

Sign in with a magic link

A magic link signs a person in with a link, or a short code, that Authwise emails to them. There is no password to set, so a realm can offer it as its only sign-in method, or next to a password for people who prefer it. This page shows how to add it to a realm and how accounts come to exist in a magic-link realm.

  • Identity server 1.56 or later, awctl 0.22 or later, and Terraform provider 0.19 or later.
  • A tenant administrator seat, or a service account holding tenant.admin.
  • A realm. See Realms.
  • Email delivery on the installation. Authwise’s hosted service sends mail; a self-hosted installation needs its messaging delivery configured by its operator.
  1. The person enters their email address on the sign-in page and clicks the magic-link button.
  2. Authwise emails them a link and a code. The email uses the realm’s magic-link message template.
  3. The person opens the link on any device, or enters the code on the device they started from. Either one signs them in. The link and the code expire together, after 10 minutes at most.

The sign-in page answers an unknown address the same way as a known one, so it never reveals whether an account exists.

  1. Open the realm, go to Providers, and click New provider.
  2. Click Magic link.
  3. In Display name, enter the button’s label, such as Email me a link.
  4. Click Create provider.

With awctl, in the realm’s context:

Terminal window
awctl identity providers create \
--display-name "Email me a link" \
--provider-type magicLink \
--config '{"@type": "type.googleapis.com/authwise.types.core.v1alpha1.ProviderMagicLink"}'

With Terraform:

data "authwise_provider_magic_link" "employees" {}
resource "authwise_provider" "magic_link" {
realm_id = authwise_realm.employees.realm_id
display_name = "Email me a link"
provider_type = "magicLink"
config = data.authwise_provider_magic_link.employees.any
}
SettingValuesDefault
modeLINK_AND_CODE sends both. CODE_ONLY sends the code alone, for sign-in pages where a link can’t be opened.LINK_AND_CODE
code_length6 to 8 digits.6
ttlHow long the link and code stay valid, up to 10 minutes. A longer value is reduced to 10 minutes.10 minutes

A person can ask for a new email 30 seconds after the last one, and gets 5 attempts at the code before they must start again.

A magic link proves the email address, so the address is the account’s identifier. An account comes to exist in a magic-link realm in one of three ways:

  • Self-signup. With the realm’s Self-signup channel open, a person whose address has no account gets one on their first sign-in. Open it in the realm’s Configuration > Provisioning.
  • An invitation. With the realm’s Invitations channel open, an administrator invites the person by email address. The invitation email carries a link; the person clicks it, confirms the address, and is signed in. There is no password to set. A realm with a magic link and no other sign-in method is an invitation-only realm when Self-signup stays closed. See Invite the first users. Needs identity server 1.65 or later; earlier versions refuse the invitation.
  • An existing account. A person who already has an account in the realm whose email address matches, such as one created with a password, signs in to that account.

The email’s wording and layout come from the magic-link message template. To change them, go to Messages under Branding, choose magic-link, and edit the template. The template’s variables include the sign-in link, the code, and how many minutes remain before they expire. The sender’s brand name and logo come from the issuer’s appearance profile, or the tenant’s branding when the issuer has none.