Enterprise login flow
An enterprise SSO login is the same three-step flow as social login:- Redirect — Your app asks the SDK to start the flow; it redirects the user to the Identity Provider.
- Callback — After authenticating, the IdP redirects back and Prelude redirects to your app with a
challenge_token. - Finalize — Your app sends the
challenge_tokento complete authentication.
challenge_token is finalized exactly like social login — via finalizeOAuthLogin. Unlike personal social login, an enterprise connection is bound to email domains, so it never returns the otp_required step: it always resolves to { status: "logged_in" }.
How is the enterprise flow secured?
How is the enterprise flow secured?
The flow is protected by PKCE (Proof Key for Code Exchange). The SDK generates a unique
code_verifier/code_challenge pair for each login and stores the verifier locally; the challenge_token can only be finalized once, by the browser that started the flow. In addition, the connection the flow launched with is pinned server-side, and the IdP-asserted email’s domain must fall within that connection’s allowlist.Redirect to the Identity Provider
There are two ways to start the flow.By email
Resolve the connection from the user’s email domain (it must match exactly one enabled connection’s allowlist):By connection
When you already know the connection, pass itsconnectionId:
redirectURI is optional — it must be allowlisted for your app, and falls back to the connection’s default_redirect_uri when omitted. The provider (Okta, Google, Microsoft) is derived server-side from the connection, so you never pass it here.
Both forms navigate the browser to the IdP. If you need the authorization URL
without navigating (e.g. to open it yourself), call
initiateEnterpriseOAuthLogin, which returns { authorization_url }.Handle the callback
When the IdP redirects back to your app, extract thechallenge_token from the URL and finalize the login — the same call used for social login and SAML:
Try it
Try it
Replace
src/App.jsx with:src/App.jsx
What’s next?
Configure a connection
Set up an enterprise OIDC connection on the backend.
Social login
Add classic social-login buttons.