Factors — JWT

Factors

This factor operates through presenting signed tokens (JWT) to our service which attest the identity of the holder. It's mostly used by applications and scripts rather than by people. We support following flavours:

  • Personal Token - We generate a long-lived token which the account uses to log in.
  • Private Key - The account signs a short-lived token with its private key. It can bring its own key pair or have one generated by our service.
  • Hosted Key Set - The account signs a short-lived token with one of its private keys, and publishes the public keys at a publicly-accessible URL.

Configuration

Next to the general configuration options, private key and hosted key set factors have following configuration options:

  • Require Validation (config.require_validation_for_enablement: boolean) - Whether a new enrollment must first be validated with a signed token before it's enabled, proving the account holds the private key. Defaults to true. Enrollments with a key pair generated by Quasr, or created by an admin, don't need validation.
  • Unique (config.unique: boolean) - Whether a public key can only be used by 1 account. Defaults to true for private key and false for hosted key set factors.

Personal token factors have no further options: tokens are valid for 1 year.

Personal Token

When the account enrolls, Quasr generates a personal token, which is returned once and can be downloaded as personal_token.jwt in the Account UI and Admin UI. The token is signed and encrypted by Quasr, so its content can't be read or changed, and it's valid for 1 year, after which the enrollment expires.

To log in the account sends the token as input to the factors endpoint of the Authentication API, with the ID of the factor or of its enrollment:

[    {        "id": "{factor_id|enrollment_id}",        "input": "{personal_token}"    }]

Private Key

The account enrolls with an RSA public key, in which case it keeps the private key itself:

  • Own key pair - The account provides its RSA public key in PEM format (-----BEGIN PUBLIC KEY-----). Unless validation isn't required, the enrollment stays pending until the account logs in once with a token signed with the matching private key.
  • Generated key pair - The account provides no key, and Quasr generates a 2048-bit RSA key pair. The private key is returned once and can be downloaded as private_key.pem (with public_key.pem) in the Account UI and Admin UI. Only the public key is stored.

Logging in: the private key, after the public key identified the account

  1. 1The Login UI signs a token with the private key on the device, and only sends the token

Signing up: a generated key pair

  1. 1Only the public key is stored: download the key pair now, the private key can't be shown again

To log in the account signs a token with its private key, using RS256, with following claims:

  • iss and sub - the ID of the account
  • aud - the token endpoint of your tenant, https://{tenant_id}.api.quasr.io/oauth2/token
  • exp - a short expiry, e.g. 5 minutes from now
{    "iss": "{account_id}",    "sub": "{account_id}",    "aud": "https://{tenant_id}.api.quasr.io/oauth2/token",    "exp": 1767225600}

The token is sent as input with the ID of the enrollment. When the enrollment isn't known yet, the account can first send its public key (PEM) with the ID of a unique factor, which returns the ID of the matching enrollment, and then send the token with that enrollment ID.

Hosted Key Set

The account enrolls with the HTTPS URL of a JSON Web Key Set (JWKS), e.g. https://example.com/.well-known/jwks.json, which Quasr fetches to check it contains a keys property. Tokens are signed and sent exactly as for a private key, and validated with the matching key of the key set, which Quasr fetches and caches.

The advantage of a hosted key set is key rotation: the account can publish a new key at the URL and start using it, without updating its enrollment. Include the kid (key ID) header in your tokens so the matching key can be found.

Applications

Applications can authenticate at the token endpoint with a private key or hosted key set instead of a client secret (private_key_jwt). Set the application's authentication factor to one of its private key or hosted key set enrollments, and send a signed token as described above (with the client ID as iss and sub) as client_assertion, with client_assertion_type urn:ietf:params:oauth:client-assertion-type:jwt-bearer.

Rotation

The key or token of an enrollment can't be changed. To rotate a personal token or private key, create a new enrollment, switch over to it, and then disable or delete the old one. See Users — Enrollments. For hosted key sets publish the new key at the URL instead.

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.

Personal Token

1. Signup: with the signup session token, send the ID of the personal token factor without input. The token is returned once in feedback.output:

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

2. Login: send the token with the ID of the factor (or of the enrollment), without session token:

POST /factors HTTP/1.1Host: {tenant_id}.api.quasr.ioContent-Type: application/json [    {        "id": "{personal_token_factor_id}",        "input": "{personal_token}"    }]
{    "result": "SUCCESS",    "feedback": {        "cause": "",        "enrollment_id": "{enrollment_id}"    },    "account_id": "{account_id}",    "session_token": "{session_token}",    "session_score": 2,    "session_exp": 1767225600}
Private Key & Hosted Key Set

1. Signup: with the signup session token, send the public key (PEM) or the URL of the key set with the ID of the factor. Leave out the input of a private key factor to have a key pair generated, which returns the private and public key once in feedback.output (separated by ;). Otherwise the enrollment is pending until validated:

POST /factors HTTP/1.1Host: {tenant_id}.api.quasr.ioAuthorization: Bearer {signup_session_token}Content-Type: application/json [    {        "id": "{private_key_factor_id}",        "input": "-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----"    }]
{    "result": "PENDING",    "feedback": {        "cause": "ENROLLMENT_PENDING",        "enrollment_id": "{enrollment_id}",        "expires_at": "2026-11-06T10:10:00.000Z",        "regex": "^[\\w-]*\\.[\\w-]*\\.[\\w-]*$"    }}

2. Complete the enrollment by sending a signed token with the ID of the enrollment:

POST /factors HTTP/1.1Host: {tenant_id}.api.quasr.ioAuthorization: Bearer {signup_session_token}Content-Type: application/json [    {        "id": "{enrollment_id}",        "input": "{signed_token}"    }]

3. Login: send a newly signed token with the ID of the enrollment:

POST /factors HTTP/1.1Host: {tenant_id}.api.quasr.ioContent-Type: application/json [    {        "id": "{enrollment_id}",        "input": "{signed_token}"    }]
{    "result": "SUCCESS",    "feedback": {        "cause": "",        "enrollment_id": "{enrollment_id}"    },    "account_id": "{account_id}",    "session_token": "{session_token}",    "session_score": 3,    "session_exp": 1767225600}
Management API

A signed-in user (or an admin, for an application or internal user) creates a personal token or private key with createEnrollment. Without input the token or generated key pair is returned once in output:

mutation {    createEnrollment(input: {        account: "{account_id}",        factor: "{personal_token_factor_id}",        subtype: "jwt:bearer",        label: "CI token",        status: ENABLED    }) {        id        status        output        expires_at    }}

An enrollment with the user's own key or key set URL is pending, and completed with updateEnrollment and a signed token as input.

2026.11.22 | © Copyright 2026 Quasr BV