Skip to main content
import { useStytchB2BClient } from '@stytch/react/b2b';

export const SSOLogin = () => {
  const stytch = useStytchB2BClient();

  const startSSO = () => {
    stytch.sso.start({
      connection_id: 'saml-connection-test-d89ff7a0-e86f-4b4d-b6a3-9a74d967528e',
      login_redirect_url: 'https://example.com/authenticate',
      signup_redirect_url: 'https://example.com/authenticate',
    });
  };

  return <button onClick={startSSO}>Sign in with SSO</button>;
};

Documentation Index

Fetch the complete documentation index at: https://stytch.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

sso.start() starts an SSO flow by redirecting the browser to Stytch’s SSO Start endpoint. The method will also generate a PKCE code_verifier and store it in localstorage on the device.

Parameters

connection_id
string
required
Globally unique UUID that identifies a specific SSO connection_id for a Member.
login_redirect_url
string
The URL Stytch redirects to after the SSO flow is completed for a Member that already exists. This URL should be a route in your application which will run sso.authenticate and finish the login.The URL must be configured as a Login URL in the Stytch Dashboard. If the field is not specified, the default Login URL will be used.
signup_redirect_url
string
The URL Stytch redirects to after the SSO flow is completed for a Member that does not yet exist. This URL should be a route in your application which will run sso.authenticate (see below) and finish the signup.The URL must be configured as a Signup URL in the Stytch Dashboard. If the field is not specified, the default Signup URL will be used.