B2B Saas Authentication

/

Guides

/

Authentication

/

Single Sign On

/

Integration Guides

/

Pre-built UI integration guide

Frontend Integration with UI Components

SSO Sequence Diagram for Prebuilt UI Integration

Complete config steps

If you haven't done so already:

  1. Complete the steps in the SSO Integration Guide Start Here
  2. Enable the Frontend SDKs in your Stytch Dashboard

2
Configure UI config

In order to render SSO as an option in the UI, you will need to pass in a config of authFlowType: AuthFlowType.Organization and include B2BProducts.sso in the products array.

import { StytchB2B } from "@stytch/nextjs/b2b";
import { B2BProducts, AuthFlowType } from "@stytch/vanilla-js";

const Login = () => {
  const config = {
    authFlowType: AuthFlowType.Organization,
    products: [B2BProducts.sso],
    ssoOptions: {},
  };

  return <StytchB2B config={config} />;
...

3
Render UI Component on Redirect URL

Render the Stytch UI component on the Redirect URL(s) that you specified in the Stytch Dashboard during the initial setup steps.

When rendered, the UI component will automatically handle the redirect from Stytch based on the stytch_token_type, and finish the authentication flow.

4
Run your app and test it out