Skip to main content
This guide covers how to start an enterprise single sign-on (OIDC) login from your web application. Make sure you have configured an enterprise connection on your backend before proceeding.

Enterprise login flow

An enterprise SSO login is the same three-step flow as social login:
  1. Redirect — Your app asks the SDK to start the flow; it redirects the user to the Identity Provider.
  2. Callback — After authenticating, the IdP redirects back and Prelude redirects to your app with a challenge_token.
  3. Finalize — Your app sends the challenge_token to complete authentication.
The 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" }.
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 its connectionId:
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 the challenge_token from the URL and finalize the login — the same call used for social login and SAML:
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.