Just-in-time user provisioning: what to check before creating an account at first login
Just-in-time (JIT) user provisioning lets a service create a user account or update an existing profile automatically at the first login, without pre-provisioning. It can reduce login friction and account setup work, but authentication success alone is not enough reason to create an account: an unintended or incorrectly matched account could be created in the target service. Define trusted issuers, user identifiers, allowed domains or groups, required approval, and deactivation procedures.
Just-in-time user provisioning: what to check before creating an account at first login
Just-in-time (JIT) user provisioning lets a service create a user account or update an existing profile automatically at the first login, without pre-provisioning. It can reduce login friction and account setup work, but authentication success alone is not enough reason to create an account: an unintended or incorrectly matched account could be created in the target service. Define trusted issuers, user identifiers, allowed domains or groups, required approval, and deactivation procedures.
JIT provisioning is an account-lifecycle decision separate from login authentication. “The user authenticated” means the identity provider (IdP) verified the login subject; the application or organization must define when that permits account creation and authorization in the target app. This article covers the pattern and risks for SAML/OIDC login without generalizing every IdP's behavior.
First-login creation flow
The user authenticates with an IdP that was configured as trusted in advance.
The target app validates the SAML Response or OIDC ID Token and authorization response under the applicable protocol and profile. Checks include trusted issuer, signature, audience, time, and request correlation; OIDC flows also validate applicable values such as `state` and the `nonce` used in the request.
The app finds an account using a protocol-appropriate identifier and its account-creation policy. OIDC and SAML use different identity-matching rules, described below.
For OIDC, the validated ID Token's `(iss, sub)` can identify the account. For SAML, use the trusted issuer and the `NameID` identifier agreed in the profile; do not use temporary identifiers such as `transient` for persistent account linking. Never automatically merge an existing account by email or display name alone. If no account matches and creation rules are met, create a new account with a minimal profile and baseline permissions. For an existing account, update only the attributes the IdP owns, according to the agreed division of attribute ownership.
Record the creation or update result, issuer, subject identifier, policy version, and timestamp for audit. Avoid unnecessary personal data and raw tokens in logs.
Design a safe JIT policy
**Restrict who can create accounts.** Combine trusted issuer, verified organization tenant, required group or role claims, and possibly email domain. Do not use email domain alone as proof of organizational membership.
**Avoid automatic privilege escalation.** Start first-login accounts with least privilege or a separate approval role. Grant sensitive roles through additional steps such as independent approval, administrator assignment, or an access package.
**Match accounts safely.** Use `(iss, sub)` for OIDC. For SAML, agree on a persistent NameID and issuer under the profile. Document rules for email changes or reassignment, issuer changes, and account merge or split.
**Separate attribute ownership.** Distinguish IdP-managed name, department, or status from app-managed settings. Do not overwrite app-specific fields with source values at every login.
**Handle errors securely.** Treat duplicate identifiers, missing claims, unexpected issuers, and existing deactivated accounts as fail-closed cases or hold them for review. Keep detailed reasons in internal logs.
**Connect offboarding and access removal.** JIT creation alone does not ensure that the target account or existing sessions disappear when a user is disabled in the IdP. Provide SCIM or another deprovisioning path.
Okta Classic Engine's JIT documentation says a profile can be created at first authentication, existing profiles may be updated during full import, and JIT can bypass some User Creation & Matching settings. This product example shows that pre-account matching and bulk-import rules may not automatically apply. Check the official documentation for the IdP in use for its actual creation, activation, and notification behavior.
Choosing between JIT and pre-provisioning
| Criterion | JIT may fit when | Pre-provisioning may fit when |
|---|---|---|
| Account creation timing | The account is needed only when the user logs in | Accounts and roles must be ready before employment or contract start |
| Audit and approval | A limited baseline account can be created on first login | Individual approval, resource owner, start/end dates matter before access |
| Revocation | A separate system and logout/deactivation path are connected | App access must be centrally revoked immediately after departure or role change |
| Exceptions and matching | There are few users and issuer-specific identifiers are simple | There are many accounts, duplicates/merges, multiple sources, or complex attribute ownership |
With either method, do not create a session just because an authentication response arrived. Check protocol validation, account status, approved roles, and target-app policy together.
References
Okta Help Center, Add and update users with Just-In-Time provisioning
OpenID Foundation, OpenID Connect Core 1.0: ID Token validation