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:
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).
To set up an IDP factor:
https://{tenant_id}.api.quasr.io/factors/oauth2/callbackNext to the general configuration options, the scope, client ID, client secret and following options can be changed later on:
config.scope: string) - The scopes requested from the IDP, which determine the claims it returns, e.g. openid email.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.config.capture_claims: boolean) - Whether the claims returned by the IDP may be captured as attributes, see Claims.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 |
|---|---|---|---|
| openid email | sub | S256 | |
| Apple | name email | sub | S256 |
| Microsoft | openid email | sub | S256 |
| openid email | sub | plain | |
| openid email | sub | - | |
| Slack | openid email | sub | S256 |
| GitHub | user | id | S256 |
| Discord | identify email | id | S256 |
| Quasr | openid | sub | S256 |
Create an OAuth client ID of type Web application in the Google Cloud Console (APIs & Services, Credentials).
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);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.
Create an app with Facebook Login in Meta for Developers.
Create an app with Sign In with LinkedIn using OpenID Connect in the LinkedIn Developer Portal.
Create an app with Sign in with Slack (OpenID Connect) at api.slack.com.
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.
Create an application in the Discord Developer Portal. The account is identified by its Discord user ID (id).
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.
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.
config.authorization_endpoint: string) - Required.config.token_endpoint: string) - Required for the code response type.config.userinfo_endpoint: string) - Used to retrieve the claims when the IDP returns no ID token.config.jwks_uri: string) and Issuer (config.issuer: string) - Used to validate the signature and issuer of ID tokens.config.response_type: string) - code (recommended), id_token or token. Make sure to set it, as no response type is set by default.config.response_mode: string) - query or form_post. Use form_post with the id_token and token response types.config.scope: string) - Defaults to openid.config.nonce: boolean) - Whether to send and validate a nonce. Defaults to true.config.code_challenge_method: string) - S256 (recommended), plain or NONE (default). Only used with the code response 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).config.client_authentication: string) - client_secret_basic, client_secret_post, private_key_jwt or none (default). See Client Authentication.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.
For the generic OAuth 2.0 / OIDC-compliant provider, you choose how Quasr authenticates itself to the IDP:
There are three ways to set up the key material for Private Key (JWT):
{tenant_id}.api.quasr.io, valid for 1 year). Register either the public key or the certificate with the IDP, whichever it accepts.-----BEGIN PRIVATE KEY-----). A certificate must be PEM-encoded (-----BEGIN CERTIFICATE-----), match the private key and be currently valid. A certificate can't be provided without its private key.factors endpoint of the Authentication API, with its own URL as input. The response is pending and contains the authorization_url of the IDP.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:
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:
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}" }}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 |
|---|---|---|---|
| Any | The provider doesn't return the claim, or its value is invalid for the attribute | ACCESS_DENIED | The provider can't be used; check its scope and the attribute's regex. |
| Any | The value belongs to more than 1 account | INTERNAL_ERROR | Make the attribute unique and resolve the duplicates. |
| Login | The identity is enrolled | SUCCESS | The user is logged in. |
| Login | The identity is enrolled, but the enrollment isn't enabled (e.g. disabled or locked) | ENROLLMENT_NOT_FOUND | Log in with another factor, or wait for a locked enrollment to unlock. |
| Login | The identity isn't enrolled, and the value belongs to an account | ENROLLMENT_NOT_BOUND | Log in to that account with another factor and link the provider. |
| Login | The identity isn't enrolled, and the value doesn't belong to any account | ENROLLMENT_NOT_FOUND | Sign up. |
| Signup / Link | The identity is already enrolled | ENROLLMENT_ALREADY_EXISTS | Log in instead. |
| Signup / Link | The value belongs to another account | ACCOUNT_ALREADY_EXISTS | Log in to that account and link the provider there. |
| Signup / Link | The value doesn't belong to any (other) account | SUCCESS | The enrollment is created. |
ENROLLMENT_NOT_BOUND and ACCOUNT_ALREADY_EXISTS contain the ID of the matching account (account_id).createEnrollment, see API).ENROLLMENT_NOT_BOUND, ACCOUNT_ALREADY_EXISTS and ACCESS_DENIED. If you build your own UI, guide the user to the next step instead.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.
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.
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.
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 }}