# SSO just-in-time provisioning: How to match a login to an existing user safely

DevFeed: [SSO just-in-time provisioning: How to match a login to an existing user safely](<https://devfeed.tech/articles/sso-just-in-time-provisioning-how-to-match-a-login-to-an-existing-user-safely-117626.md>)

Original publisher: [Read original article](<https://workos.com/blog/sso-jit-provisioning-account-matching>)

Author: WorkOS

Published: 2026-11-04T00:00:00Z

Content type: article

Language: en

Sources: [WorkOS](<https://devfeed.tech/sources/workos-blog.md>)

Topics: [Single sign-on (SSO)](<https://devfeed.tech/topics/sso.md>), [OpenID connect (OIDC)](<https://devfeed.tech/topics/oidc.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>)

Tags: [2026](<https://devfeed.tech/tags/2026.md>), [api](<https://devfeed.tech/tags/api.md>), [app](<https://devfeed.tech/tags/app.md>), [attack](<https://devfeed.tech/tags/attack.md>), [auth](<https://devfeed.tech/tags/auth.md>), [authentication](<https://devfeed.tech/tags/authentication.md>), [automatically](<https://devfeed.tech/tags/automatically.md>), [blocks](<https://devfeed.tech/tags/blocks.md>), [branch](<https://devfeed.tech/tags/branch.md>), [callback](<https://devfeed.tech/tags/callback.md>), [condition](<https://devfeed.tech/tags/condition.md>), [email](<https://devfeed.tech/tags/email.md>), [just](<https://devfeed.tech/tags/just.md>), [login](<https://devfeed.tech/tags/login.md>), [order](<https://devfeed.tech/tags/order.md>), [provisioning](<https://devfeed.tech/tags/provisioning.md>), [safely](<https://devfeed.tech/tags/safely.md>), [sso](<https://devfeed.tech/tags/sso.md>), [store](<https://devfeed.tech/tags/store.md>), [user](<https://devfeed.tech/tags/user.md>)

## AI overview

For a custom SSO callback, resolve an existing identity first using the persistent `idp_id` scoped to its connection; if none exists, link by email only when the connection's organization has verified the email domain or an authoritative identity provider asserts a verified address. Otherwise create a separate user or require inbox proof before linking. Store the identity separately from the user, key it by the `idp_id` and connection pair, and refresh mutable profile attributes on returning sign-ins. Scope email lookups deliberately because a global match may belong to another customer. WorkOS's domain check blocks nonmatching profiles by default, but the callback should still enforce its own linking condition. The excerpt says AuthKit follows a similar link-first, verified-email, then create order, with verification and guest-invitation behavior handled in its flow.

## Source excerpt

Just-in-time provisioning is a resolution order in your SSO callback. Here is the order, the condition that makes the email match safe, and what to store.