Quasr issues self-contained JSON Web Tokens (JWTs). Your applications receive the standard OAuth 2.0 and OpenID Connect tokens: the access token (to call APIs), the refresh token (to obtain new tokens) and the identity token (with the user's identity claims). The other tokens are used internally during login and signup.
| Token | Purpose | Used By | Default Lifetime | Configured Per |
|---|---|---|---|---|
| Session | Tracks a login or signup in progress, its score and factors passed | Login UI | 1 day (login), 15 minutes (signup) | Tenant |
| Consent | Captures the scopes, claims and attributes granted to the application | Login UI | 5 minutes (one-time use) | Tenant |
| Authorization Code | Exchanged by the application for tokens (OAuth 2.0) | Application | 5 minutes (fixed) | Application |
| Access | Authorizes requests to APIs (OAuth 2.0) | Application, API | 1 day (max 30 days) | Application |
| Refresh | Obtains new access tokens without a new login (OAuth 2.0), if the scope contains offline_access | Application | 1 week (max 1 year, one-time use) | Application |
| Identity | Conveys the identity of the user to the application (OpenID Connect), if the scope contains openid | Application | 5 minutes (max 1 day) | Application |
The tokens follow each other during a login (or signup) as follows:
openid and a refresh token if it contains offline_access.Machine applications skip the login and request an access token directly, see Applications — Machine (M2M).
All tokens are JWTs signed by Quasr with RS256, using 2048-bit RSA keys held in AWS Key Management Service (see Security). The key ID (kid) in the header refers to the public key in your tenant's key set. Tokens contain following types of claims:
iss (your tenant: https://{tenant_id}.api.quasr.io), sub (the account ID), aud, exp, iat, jti, scope and client_id.https://api.quasr.io/claims/ used by Quasr itself, e.g. typ (the token type), ten (the tenant), scr (the session score) and fct (the factors passed).Tokens can also be encrypted (JWE, RSA-OAEP-256 with A128CBC-HS256):
Applications and APIs validate tokens themselves with the public keys of your tenant, published at https://{tenant_id}.api.quasr.io/.well-known/jwks.json (also listed in the discovery document). Always:
kid, and only accept RS256kid from the key set instead of pinning a single key, and fetch the key set again when a token has a kid you don't know: signing keys are rotated yearly, and new keys are published in the key set well before they're usediss is https://{tenant_id}.api.quasr.io, aud contains your API (or client ID for identity tokens) and the token isn't expired (exp)scope (access tokens) for the permissions the request needsLocal validation can't detect a revoked token. If you need that for access tokens, use the introspection endpoint (POST oauth2/introspect), which returns whether an access token is still active. It requires an access token with the https://api.quasr.io/scopes/oauth2/introspect scope. See Standards — JWT and APIs — Authentication.
Tokens valid for 1 hour or more are tracked by Quasr and can be revoked before they expire. Shorter tokens, such as identity tokens, consent tokens and authorization codes, expire quickly and aren't tracked. Tracked tokens are revoked:
POST oauth2/revoke)listTokens and updateToken operations of the Management APIThe tokens of one account, in its Tokens tab
Next to encryption, following options protect tokens. They're configured per application for access, refresh and identity tokens and authorization codes (see Applications — Configuration), and per tenant for session and consent tokens:
ipb) - The token can only be used from the IP address it was issued to. This protects against token theft, but breaks when users switch networks.use) - How often a token can be used. Consent tokens, authorization codes and refresh tokens can only be used once, so a stolen one can't be reused after it was used.exp) - Shorter lifetimes limit the impact of a leaked token.