Factors — Identity Provider (IdP)

Factors

This factor operates by securely talking to an Identity Provider (IDP), such as Google or Apple, which performs authentication but can also return attributes about the account.

Accounts can use this factor to authenticate with an Identity Provider (IDP) - which is an online service provider that provides identities. The IDP will perform its own user authentication, and can also provide user claims (attributes) which can be captured in Quasr using sources (see Capturing Claims). At this moment IDPs that support the following can be configured:

  • OpenID Connect 1.0 (OIDC)
  • OAuth 2.x + API that provides claims using access token (similar to the UserInfo endpoint in OIDC)

Besides a generic factor allowing you to configure any OAuth 2.0 / OIDC-compliant provider, Google, Apple, Microsoft, Facebook (Meta), LinkedIn, Slack, GitHub, Discord and Quasr are supported out-of-the-box (see Providers).

Below is a sample screenshot to give an idea of a potential login / registration page offering Identity Provider (IDP) options. On a login or registration page the IDP is often represented by an icon (logo).

Setup

To set up an IDP factor:

  1. Register an application (often called an OAuth client or app) with the IDP, and register following redirect (callback) URI: https://{tenant_id}.api.quasr.io/factors/oauth2/callback
  2. Copy the client ID and client secret the IDP issues for the application.
  3. In the Admin UI go to Factors, click Create, choose the IDP and enter the client ID and client secret (not needed for Quasr).
  4. Enable the factor, and give it a score reflecting the security of the IDP.

Next to the general configuration options, the scope, client ID, client secret and following options can be changed later on:

  • Scope (config.scope: string) - The scopes requested from the IDP, which determine the claims it returns, e.g. openid email.
  • Redirect URIs (config.redirect_uris: string[]) - The URLs of your Login UI and Account UI the user returns to after authenticating with the IDP. Defaults to the Quasr Login UI and Account UI of your tenant (https://{tenant_id}.login.quasr.io and https://{tenant_id}.account.quasr.io); add your own UI if you have one, and keep these as long as your users use the Quasr UIs (see Interfaces). The URL your UI passes when starting a login or signup must exactly match one of these.
  • Capture Claims (config.capture_claims: boolean) - Whether the claims returned by the IDP may be captured as attributes, see Claims.
  1. 1From your OAuth client in the Google Cloud Console, together with the client secret
  2. 2Determines which claims Google returns, e.g. email and profile for the name
  3. 3Lets sources capture the returned claims as attributes, e.g. the email address
  4. 4The source checked at every login and signup, e.g. so the same email address can't sign up twice, see Source Check

Providers

For the out-of-the-box IDPs the endpoints and protocol settings are preset, and only the scope can be changed:

Provider Default Scope Identifier PKCE
Googleopenid emailsubS256
Applename emailsubS256
Microsoftopenid emailsubS256
Facebookopenid emailsubplain
LinkedInopenid emailsub-
Slackopenid emailsubS256
GitHubuseridS256
Discordidentify emailidS256
QuasropenidsubS256
Google

Create an OAuth client ID of type Web application in the Google Cloud Console (APIs & Services, Credentials).

Apple

Create a Services ID with Sign in with Apple in your Apple Developer account. Apple doesn't issue a static client secret: you generate it yourself as a JWT signed with your Sign in with Apple key, and must renew it before it expires (at most every 6 months).

You can generate the client secret with following Node.js script, using the jsonwebtoken package and the private key (.p8 file) you created for Sign in with Apple:

const fs = require('fs');const jwt = require('jsonwebtoken'); const privateKey = fs.readFileSync('AuthKey_{key_id}.p8').toString(); const clientSecret = jwt.sign({}, privateKey, {    algorithm: 'ES256',    expiresIn: '180d', // maximum allowed by Apple    issuer: '{team_id}', // your Team ID    audience: 'https://appleid.apple.com',    subject: '{services_id}', // your Services ID (client ID)    keyid: '{key_id}' // the Key ID of your private key}); console.log(clientSecret);
Microsoft

Register an application in Microsoft Entra (App registrations). The out-of-the-box factor supports personal Microsoft accounts. For work or school accounts of your organization use the generic OpenID Connect factor with the endpoints of your Entra tenant.

Facebook

Create an app with Facebook Login in Meta for Developers.

LinkedIn

Create an app with Sign In with LinkedIn using OpenID Connect in the LinkedIn Developer Portal.

Slack

Create an app with Sign in with Slack (OpenID Connect) at api.slack.com.

GitHub

Create an OAuth App in your GitHub developer settings. GitHub doesn't support OpenID Connect, so the account is identified by its GitHub user ID (id) and claims are retrieved from the GitHub API.

Discord

Create an application in the Discord Developer Portal. The account is identified by its Discord user ID (id).

Quasr

Login with Quasr lets users sign in with their Quasr account. No client ID or secret is needed: when you create the factor Quasr registers your tenant as application automatically, authenticating with a private key and signed requests. The factor is pending until this is done.

OpenID Connect

The generic factor can be configured for any OpenID Connect or OAuth 2.0 IDP with following options. Most values can be found in the IDP's discovery document (/.well-known/openid-configuration), which Quasr doesn't read automatically.

  • Authorization Endpoint (config.authorization_endpoint: string) - Required.
  • Token Endpoint (config.token_endpoint: string) - Required for the code response type.
  • UserInfo Endpoint (config.userinfo_endpoint: string) - Used to retrieve the claims when the IDP returns no ID token.
  • JWKS URI (config.jwks_uri: string) and Issuer (config.issuer: string) - Used to validate the signature and issuer of ID tokens.
  • Response Type (config.response_type: string) - code (recommended), id_token or token. Make sure to set it, as no response type is set by default.
  • Response Mode (config.response_mode: string) - query or form_post. Use form_post with the id_token and token response types.
  • Scope (config.scope: string) - Defaults to openid.
  • Nonce (config.nonce: boolean) - Whether to send and validate a nonce. Defaults to true.
  • PKCE (config.code_challenge_method: string) - S256 (recommended), plain or NONE (default). Only used with the code response type.
  • Content Type (config.content_type: string) - How requests to the token endpoint are encoded: application/json (default) or application/x-www-form-urlencoded (as in the OAuth 2.0 standard).
  • Client Authentication (config.client_authentication: string) - client_secret_basic, client_secret_post, private_key_jwt or none (default). See Client Authentication.
  • Signed Request (config.signed_request: boolean) - Whether to send the authorization request as a signed JWT (request parameter). Requires the issuer.

The account is identified by the sub claim. With the code response type, an ID token returned by the token endpoint is validated (signature, issuer, audience and nonce) and its claims are used; without ID token the claims are retrieved from the UserInfo endpoint with the access token.

Client Authentication

For the generic OAuth 2.0 / OIDC-compliant provider, you choose how Quasr authenticates itself to the IDP:

  • Client Secret - the most common setup; the IDP issues a shared secret which Quasr sends with each request (either as a POST body parameter or an HTTP Basic header).
  • Private Key (JWT) - Quasr signs a short-lived assertion with a private key instead of sending a secret. The IDP verifies the assertion using the matching public key or certificate you registered with it.
Private Key (JWT)

There are three ways to set up the key material for Private Key (JWT):

  1. Generated by Quasr (key pair and certificate) - leave the private key empty and Quasr generates a 2048-bit RSA key pair plus a self-signed X.509 certificate (common name {tenant_id}.api.quasr.io, valid for 1 year). Register either the public key or the certificate with the IDP, whichever it accepts.
  2. Your own private key - provide an RSA private key and register its public key with the IDP yourself. Quasr doesn't generate a certificate in this case.
  3. Your own private key and certificate - provide an RSA private key together with its X.509 certificate (for example one issued by your own certificate authority), and register the certificate with the IDP.

Login & Signup

  1. The UI sends the ID of the factor (or of the enrollment) to the factors endpoint of the Authentication API, with its own URL as input. The response is pending and contains the authorization_url of the IDP.
  2. The UI redirects the user to the IDP, where they authenticate.
  3. The IDP redirects the user to the Quasr callback, which validates the response and redirects the user back to the UI.
  4. The UI sends the returned input to the factors endpoint to complete the login or signup.

The account is matched by the IDP's identifier for the user (e.g. sub), which is only stored as secure hash. Following applies:

  • logging in with an identity that isn't enrolled yet fails; the user must sign up first
  • signing up with an identity that is already enrolled fails; the user must log in instead
  • if the user cancels at the IDP the attempt is rejected
  • the user has 1 hour to complete the authentication at the IDP

Claims

The claims returned by the IDP, such as name and email address, aren't stored by default. With Capture Claims enabled they can be stored as attributes using sources, which map an IDP claim to an attribute. The Login UI asks the user whether their profile details may be used, and only captures them if the user agrees.

For example, to store the given name returned by Google in the Given Name attribute:

  1. enable Capture Claims on the Google factor
  2. in the Admin UI go to Attributes, select the Given Name attribute and click Create in its Sources tab
  3. select the Google factor, enter the name of the IDP claim (given_name) and enable the source (sources are disabled by default)

Or with the createSource operation of the Management API:

mutation {    createSource(input: {        attribute: "{given_name_attribute_id}",        factor: "{google_factor_id}",        claim: "given_name",        label: "Google given name",        status: ENABLED    }) {        id        status    }}

From then on, every login or signup with Google where the user agrees to share their profile stores the given name as a claim of the user, linked to their Google enrollment. As claims are immutable, a changed value is added as new claim (or ignored for singular attributes), unless the source has Replace enabled, which is the default for picture. Nested claims, such as address.locality, can't be sourced individually. Create a source per claim you want to capture, e.g. email, family_name or picture. See Attributes — Sources.

When claims are captured, a Capture Claims event (capture-claims) is produced, which the sources process. You can also react to it yourself with an extension, e.g. to sync the profile to your own systems. The claims are included in its values, which are passed to extensions but never logged. See Events — Catalog.

{    "type": "DATA",    "origin": "{enrollment_id}",    "action": "capture-claims",    "values": {        "{claim_name}": "{claim_value}"    },    "result": "SUCCESS",    "tenant_id": "{tenant_id}",    "account_id": "{account_id}",    "detail": {        "provider": "{factor_label}",        "factor_id": "{factor_id}"    }}

Source Check

An IDP factor can refer to one of its sources as Source (config.source), set in the factor's configuration in the Admin UI or with updateFactor. The source's claim is then checked on every login and signup with the provider, typically the email address with a unique email attribute. This makes sure users always have the claim, and prevents them from creating a second account for an email address that already belongs to an account. Following scenarios apply, with the result returned in step 3 of the flow:

Mode Situation Result Next Step
AnyThe provider doesn't return the claim, or its value is invalid for the attributeACCESS_DENIEDThe provider can't be used; check its scope and the attribute's regex.
AnyThe value belongs to more than 1 accountINTERNAL_ERRORMake the attribute unique and resolve the duplicates.
LoginThe identity is enrolledSUCCESSThe user is logged in.
LoginThe identity is enrolled, but the enrollment isn't enabled (e.g. disabled or locked)ENROLLMENT_NOT_FOUNDLog in with another factor, or wait for a locked enrollment to unlock.
LoginThe identity isn't enrolled, and the value belongs to an accountENROLLMENT_NOT_BOUNDLog in to that account with another factor and link the provider.
LoginThe identity isn't enrolled, and the value doesn't belong to any accountENROLLMENT_NOT_FOUNDSign up.
Signup / LinkThe identity is already enrolledENROLLMENT_ALREADY_EXISTSLog in instead.
Signup / LinkThe value belongs to another accountACCOUNT_ALREADY_EXISTSLog in to that account and link the provider there.
Signup / LinkThe value doesn't belong to any (other) accountSUCCESSThe enrollment is created.
  • The responses for ENROLLMENT_NOT_BOUND and ACCOUNT_ALREADY_EXISTS contain the ID of the matching account (account_id).
  • To link the provider to their existing account, the user logs in to that account with another factor, and adds the provider in the Account UI (or with createEnrollment, see API).
  • Our Login UI currently shows a generic error for ENROLLMENT_NOT_BOUND, ACCOUNT_ALREADY_EXISTS and ACCESS_DENIED. If you build your own UI, guide the user to the next step 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.

Login

1. Send the ID of the IDP factor with the URL of your UI as input, which must be one of the factor's Redirect URIs. The response contains the authorization_url of the IDP:

POST /factors HTTP/1.1Host: {tenant_id}.api.quasr.ioContent-Type: application/json [    {        "id": "{google_factor_id}",        "input": "https://{tenant_id}.login.quasr.io"    }]
{    "result": "PENDING",    "feedback": {        "cause": "OAUTH2_PENDING",        "authorization_url": "https://accounts.google.com/o/oauth2/v2/auth?client_id=...",        "authorization_state": "{state_id}",        "authorization_mode": "login",        "expires_at": "2026-11-06T10:10:00.000Z"    }}

2. Redirect the user to the authorization_url. After authenticating, the IDP sends the user to the Quasr callback, which redirects back to your UI with an id and an input as query parameters:

HTTP/1.1 302 FoundLocation: https://{tenant_id}.login.quasr.io?id={enrollment_id}&input={state_id}_{secret}

3. Send the returned id and input to complete the login. If the factor captures claims, they're included in feedback.claims:

POST /factors HTTP/1.1Host: {tenant_id}.api.quasr.ioContent-Type: application/json [    {        "id": "{enrollment_id}",        "input": "{state_id}_{secret}"    }]
{    "result": "SUCCESS",    "feedback": {        "cause": "",        "enrollment_id": "{enrollment_id}",        "claims": {            "sub": "{google_user_id}",            "email": "jane@example.com",            "given_name": "Jane"        }    },    "account_id": "{account_id}",    "session_token": "{session_token}",    "session_score": 3,    "session_exp": 1767225600}

If the identity isn't enrolled yet, step 3 returns FAILED with cause ENROLLMENT_NOT_FOUND, and the user must sign up instead. If the user cancels at the IDP the cause is REJECTED_LOGIN.

If the identity is enrolled but the enrollment isn't enabled (e.g. disabled or locked), step 3 also returns FAILED with cause ENROLLMENT_NOT_FOUND, so the enrollment's status isn't revealed. Signing up isn't possible in that case (it returns ENROLLMENT_ALREADY_EXISTS): the user must log in with another factor, or wait for a locked enrollment to unlock.

Signup

A signup follows the same 3 steps, with the signup session token. Step 1 creates a pending enrollment, whose ID is returned in the response and in the redirect to your UI:

{    "result": "PENDING",    "feedback": {        "cause": "ENROLLMENT_PENDING",        "enrollment_id": "{enrollment_id}",        "authorization_url": "https://accounts.google.com/o/oauth2/v2/auth?client_id=...",        "authorization_state": "{state_id}",        "authorization_mode": "signup",        "expires_at": "2026-11-06T10:10:00.000Z",        "regex": "{regex}"    }}

If the identity is already enrolled, step 3 returns FAILED with cause ENROLLMENT_ALREADY_EXISTS, and the user must log in instead.

Management API

A signed-in user links an IDP with createEnrollment, passing the URL of your UI as input. The response contains the authorization URL in output; after the redirect back, complete the enrollment with updateEnrollment and the returned input:

mutation {    createEnrollment(input: {        account: "{account_id}",        factor: "{google_factor_id}",        subtype: "oauth2:google",        input: "https://{tenant_id}.account.quasr.io",        status: ENABLED    }) {        id        status        output    }} mutation {    updateEnrollment(input: {        id: "{enrollment_id}",        input: "{state_id}_{secret}"    }) {        id        status    }}
2026.11.22 | © Copyright 2026 Quasr BV