SSO protocols
Stytch supports two SSO protocols:SAML
Security Assertion Markup Language - XML-based protocol commonly used in enterprise environments
- IdP-initiated and SP-initiated flows
- Supports signed assertions and responses
- Works with Okta, Azure AD, Google Workspace, OneLogin, etc.
OIDC
OpenID Connect - Modern authentication protocol built on OAuth 2.0
- JSON-based with simpler implementation
- Uses JWTs for identity tokens
- Works with Okta, Azure AD, Google, and other providers
SSO authentication flow
The typical SSO authentication flow involves several steps coordinated between your application, Stytch, and the organization’s identity provider (IdP).Start the SSO flow
Initiate the SSO flow by redirecting the user to their identity provider. First, retrieve the organization’s SSO connections to get the IdP URLs:This returns all SAML and OIDC connections configured for the organization, including the URLs needed to start authentication.
Redirect to IdP
Redirect the user to their identity provider using the connection details:
- SAML
- OIDC
Use the The IdP will handle authentication and redirect back to the
idp_sso_url from the connection object to redirect the user’s browser:acs_url with a SAML assertion.Handle the callback
After the user authenticates at their IdP, Stytch processes the SAML assertion or OIDC token and redirects back to your application with an Extract the
sso_token as a query parameter:token value from the URL query parameters.Authenticate the SSO token
Exchange the SSO token for a member session by calling the authenticate endpoint:Key parameters:
sso_token: The token from the callback URL (required)session_duration_minutes: How long the session should last (default: 60)session_custom_claims: Custom data to include in the session JWTsession_tokenorsession_jwt: Existing session to link to (optional)