Factors — Secret

Factors

This factor operates by a shared secret between the account and our service. Some secrets identify the account, such as a username, email address or phone number, and are relatively publicly known, so the score of those factors should be considered low. Others prove the account's identity, such as a password, and should have a higher score. A typical setup combines both, e.g. an email address (score 1) followed by a password (score 2).

We support following secret factors:

Factor Subtype Unique Case Sensitive Default Regex Default Threshold
Usernamesecret:idYesNo^.{1,100}$0
Emailsecret:id:emailYesNo (fixed)Email address (fixed)-
Phonesecret:id:phoneYesNo (fixed)E.164 phone number (fixed)-
Passwordsecret:passwordNoYes^.{15,100}$2
SecretsecretNoYes^[a-zA-Z0-9]{43}$2

Configuration

Next to the general configuration options, secret factors have following configuration options:

  • Regex (config.regex: string) - Regular expression (RegEx) the value must match when enrolling. Fixed for email and phone factors.
  • Threshold (config.threshold: number) - Only for secret, username and password factors. The minimum strength of the value when enrolling, from 0 (no check) to 4 (very high). Defaults to 2 (medium) for secret and password factors, and to 0 for username factors. Strength is estimated with zxcvbn, which detects common passwords, names, keyboard patterns, repetitions and dates.
  • Unique (config.unique: boolean) - Whether a value can only be used by 1 account. Only unique factors identify the account, and can therefore be used as first factor for login or signup.
  • Case Sensitive (config.case_sensitive: boolean) - Whether values are case sensitive. Always disabled for email and phone factors.
  • Capture Input (config.capture_input: boolean) - Whether the value may be captured as claim by a source, e.g. to store the email address used to sign up as attribute. Not available for password factors.

Storage

Secrets are never stored in clear, only hashed with Argon2id. Hence a secret can't be retrieved afterwards, not even by an admin. For factors which aren't case sensitive the value is converted to lower case before hashing.

Generated Secrets

When enrolling in a secret, username or password factor without a value, Quasr generates a random value which matches the factor's regex and threshold (and is unique if required). For the default secret factor this is a value of 43 letters and digits. In the Login UI users can choose to generate a secret or password when signing up.

A generated value doesn't need to be validated, even if the factor requires validation: the enrollment immediately gets the requested status (e.g. enabled) instead of pending.

Choose a password, or have one generated

  1. 1Generates a password matching the factor's regex and threshold

The generated password, shown only once

  1. 1Only stored as secure hash: copy it now, it can't be shown again

Login

To log in the value is sent to the factors endpoint of the Authentication API, together with either:

  • the ID of a unique factor, e.g. the email factor, in which case the value identifies the account; or
  • the ID of the account's enrollment, e.g. its password, after the account has been identified.

On success the factor's score is added to the session. Failed attempts against an enrollment count towards locking it.

Username

A generic identifier chosen by the user, unique and not case sensitive by default, of 1 to 100 characters. You can restrict it with your own regex, e.g. ^[a-z0-9_]{3,30}$.

Email

Uses the email address as identifier. It's always unique and never case sensitive.

Phone

Uses the phone number as identifier, in international E.164 format (a plus sign, the country code and the number without leading zero, e.g. +32470123456). It's always unique.

Password

A password of 15 to 100 characters by default, which must meet the factor's threshold. Following current guidance (e.g. NIST SP 800-63B) we favour length over composition rules, so there are no requirements for digits or symbols.

The value of an enrollment can't be changed. To change or reset a password, create a new password enrollment and delete the old one. Users can do so in the Account UI after logging in with another factor. Admins can only do so for internal users; for other users they can disable the old password, after which the user sets a new one. See Users — Enrollments.

Secret

A long, typically generated, secret. Its main use is authenticating applications with a client secret: the application's authentication factor is set to one of its secret (or password) enrollments, and the application sends the secret to the token endpoint either in the Authorization header (client_secret_basic) or in the request body (client_secret_post).

API

Below are the steps for the factors endpoint of the Authentication API. See Factors — Authentication API for how requests, responses, sessions and the Management API work in general.

Login

1. Send the username or email address with the ID of the (unique) username or email factor, without session token. This identifies the account and returns a session token:

POST /factors HTTP/1.1Host: {tenant_id}.api.quasr.ioContent-Type: application/json [    {        "id": "{email_factor_id}",        "input": "jane@example.com"    }]
{    "result": "SUCCESS",    "feedback": {        "cause": "",        "enrollment_id": "{email_enrollment_id}"    },    "account_id": "{account_id}",    "session_token": "{session_token}",    "session_score": 1,    "session_exp": 1767225600}

2. Retrieve the account's enrollments with GET /factors and the session token, and send the password with the ID of the password enrollment:

POST /factors HTTP/1.1Host: {tenant_id}.api.quasr.ioAuthorization: Bearer {session_token}Content-Type: application/json [    {        "id": "{password_enrollment_id}",        "input": "correct horse battery staple"    }]
{    "result": "SUCCESS",    "feedback": {        "cause": "",        "enrollment_id": "{password_enrollment_id}"    },    "account_id": "{account_id}",    "session_token": "{session_token}",    "session_score": 3,    "session_exp": 1767225600}

A wrong password returns FAILED with cause INCORRECT_INPUT.

Signup

1. With the signup session token, send the username or email address with the ID of the factor. This creates the enrollment:

POST /factors HTTP/1.1Host: {tenant_id}.api.quasr.ioAuthorization: Bearer {signup_session_token}Content-Type: application/json [    {        "id": "{email_factor_id}",        "input": "jane@example.com"    }]

If the factor requires validation, e.g. for email and phone factors, the response is pending, and the enrollment is completed by sending the same value with the ID of the enrollment:

{    "result": "PENDING",    "feedback": {        "cause": "ENROLLMENT_PENDING",        "enrollment_id": "{email_enrollment_id}",        "expires_at": "2026-11-06T10:10:00.000Z",        "regex": "{regex}"    }}

2. Send the password with the ID of the password factor. To have a password generated instead, leave out the input; it's returned once in feedback.output:

POST /factors HTTP/1.1Host: {tenant_id}.api.quasr.ioAuthorization: Bearer {session_token}Content-Type: application/json [    {        "id": "{password_factor_id}"    }]
{    "result": "SUCCESS",    "feedback": {        "cause": "",        "enrollment_id": "{password_enrollment_id}",        "output": "{generated_password}"    },    "account_id": "{account_id}",    "session_token": "{session_token}",    "session_score": 3,    "session_exp": 1767225600}

A value that doesn't match the factor's regex or threshold returns FAILED with cause INVALID_INPUT, and a value of a unique factor that is already used RESERVED_INPUT.

Management API

A signed-in user adds a password (or other secret) with createEnrollment; leave out the input to have one generated and returned in output:

mutation {    createEnrollment(input: {        account: "{account_id}",        factor: "{password_factor_id}",        subtype: "secret:password",        input: "correct horse battery staple",        status: ENABLED    }) {        id        status        output    }}
2026.11.22 | © Copyright 2026 Quasr BV