The sso.start() method 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.
Start SSO flow
Method parameters
Globally unique UUID that identifies a specific SSO connection_id for a Member.
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 (see below) and finish the login.
The URL must be configured as a Login URL in the Redirect URL page. If the field is not specified, the default Login URL will be used.
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 Redirect URL page. If the field is not specified, the default Signup URL will be used.
import { useStytchB2BClient } from '@stytch/react/b2b';
export const Login = () => {
const stytch = useStytchB2BClient();
const startSSO = () =>
stytch.sso.start({
connection_id: 'saml-connection-test-51861cbc-d3b9-428b-9761-227f5fb12be9',
login_redirect_url: 'https://example.com/authenticate',
signup_redirect_url: 'https://example.com/authenticate',
});
return <button onClick={startSSO}>Log in with Okta</button>;
};