/
Contact usSee pricingStart building
    Overview
    Changelog
    Installation

    Pre-built UI

    StytchB2B
      Configuration
      Callbacks
      Text Customization
      Component Playground
    Admin Portal
      SSO
      Org Settings
      Member Management
      SCIM
    B2BIdentityProvider
      Configuration
      UI Callbacks

    Headless

    Organizations
      Get Organization
      Get Organization by Slug
      Update Organization
      Delete Organization
      Get Organization Connected Apps
      Get Organization Connected App
    Members
      Get Member
      Create Member
      Update Member
      Search Members
      Delete Member
      Reactivate Member
      Delete Member Password
      Delete Member MFA Phone Number
      Delete Member MFA TOTP
      Unlink Retired Member Email
      Start Member Email Update
      Update Self
      Delete Self Password
      Delete Self MFA Phone Number
      Delete Self MFA TOTP
      Unlink Retired Self Email
      Start Self Email Update
      Update Member (Deprecated)
      Delete Member MFA Phone Number (Deprecated)
      Get Member Connected Apps
      Get Self Connected Apps
      Revoke Member Connected App
      Revoke Self Connected App
    RBAC
      Is Authorized
      Permissions
    Email Magic Links
      Login or Signup
      Invite
      Authenticate
      Send Discovery Email
      Authenticate Discovery Magic Link
    Email One-time Passcodes (OTPs)
      Login or Signup
      Authenticate OTP
      Send Discovery Email OTP
      Authenticate Discovery Email OTP
    OAuth
      Start OAuth Flow
      Google One Tap
      Authenticate
      Start Discovery OAuth Flow
      Discovery Authenticate
    Session Management
      Get Session
      Authenticate Session
      Revoke Session
      Update Session
      Exchange Session
      Get Tokens
      Revoke Sessions for Member
      Attest Session
      Exchange Access Token
    SSO
      Start SSO Flow
      Authenticate
      Get SSO Connections
      Discover SSO Connections
      Delete SSO Connection
      Create SAML Connection
      Update SAML Connection
      Update SAML Connection by Metadata URL
      Delete Encryption Private Key
      Delete Verification Certificate
      Create OIDC Connection
      Update OIDC Connection
      Create External Connection
      Update External Connection
    Discovery
      List Discovered Organizations
      Create Organization via Discovery
      Exchange Intermediate Session
    Passwords
      Authenticate
      Reset by Email Start
      Reset by Email
      Reset by Existing Password
      Reset by Session
      Strength Check
    • Discovery

      • Authenticate
        Reset by Email Start
        Reset by Email
    SCIM
      Create SCIM Connection
      Update SCIM Connection
      Delete SCIM Connection
      Get SCIM Connection
      SCIM Token Rotation Start
      SCIM Token Rotation Complete
      SCIM Token Rotation Cancel
      Get SCIM Connection Groups
    Multi-Factor Authentication
    • One-Time Passcodes

      • SMS Send
        SMS Authenticate
    • Time-Based One-Time Passcodes

      • TOTP Create
        TOTP Authenticate
    • Recovery Codes

      • Recovery Codes Recover
        Rotate Recovery Codes
        Get Recovery Codes
    Impersonation
      Authenticate
    Connected Apps
    • Consent Management

      • Start OAuth Authorization
        Submit OAuth Authorization

    More Resources

    Cookies & session management
    SWR & caching
    TypeScript
Get support on SlackVisit our developer forum

Contact us

B2B SaaS Authentication

/

Frontend SDKs

/

Pre-built UI

/

B2BIdentityProvider

/

Configuration

B2B IdentityProvider configuration

B2BIdentityProvider

IDP SSO Consent Screen UI

The B2BIdentityProvider function renders UI to enable the logged-in member to perform an OAuth Authorization flow with a pre-registered Connected App. The UI component will automatically parse out OAuth related fields from the query params, such as client_id, redirect_uri, scope, and state.

The member must be logged in before this component is rendered.

For an overview of when consent is required, see our Consent Management guide.


Fields


styles object

The style object allows you to customize the look of the SDK. You can specify some of them or none at all. We'll use our defaults for the ones you don't specify.

fontFamily string

The font family that will apply to all text in the SDK.

hideHeaderText boolean

When this value is true, the title and description text will not show in the SDK.

container object

The configuration object for the Stytch UI container.

width string

The width of the SDK container.

backgroundColor string

The background color of the SDK container.

borderColor string

The border color of the SDK container.

borderRadius string

The border radius of the SDK container.

colors object

The configuration object for colors used in the Stytch UI components.

primary string

Your primary brand color. This will be applied to most of the text in the SDK.

secondary string

Your secondary brand color. This will be applied to text disclaimers and other visual elements.

success string

A success color to be used in visual elements.

error string

An error color to be used in visual elements.

buttons object

The configuration object for buttons in the Stytch UI component.

primary object

The configuration object for primary buttons

textColor string

The text color of the primary button.

backgroundColor string

The background color of the primary button.

borderColor string

The border color of the primary button.

borderRadius string

The border radius of the primary button.

secondary object

The configuration object for secondary buttons

textColor string

The text color of the secondary button.

backgroundColor string

The background color of the secondary button.

borderColor string

The border color of the secondary button.

borderRadius string

The border radius of the secondary button.

inputs object

The configuration object for text inputs in the Stytch UI components.

textColor string

The text color of the text inputs.

backgroundColor string

The background color of the text inputs.

placeholderColor string

The color of the placeholder text in the text inputs.

borderColor string

The border color of the text inputs.

borderRadius string

The border radius of the text inputs.

logo object

The configuration object for your custom logo.

logoImageUrl string

The URL of your custom logo. The image will be resized to fit a max height of 50px, and a max width of 100px.


callbacks object

Optional callbacks that are triggered by various events in the SDK. See more details about the callbacks here.

onEvent (data) => void

A callback function that responds to events sent from the SDK.

onError (data) => void

A callback function that responds to errors in the SDK. It is useful for debugging during development and error handling in production.


getIDPConsentManifest function

Optional function to customize the consent screen based on the scopes requested by the client.

This function expects an object of type { scopes: []string; clientName: string } and returns a type of IDPConsentSection[] | IDPConsentItem[].

If not provided, default scope descriptions will be used.

IDPConsentSection {header: string; items: []IDPConsentItem}

A top-level UI section with a header and multiple sub-items.{header: "ChatGPT is requesting to:", items: ["view your saved information"]}

IDPConsentItem string | { text: string; details: []string }

A single item to render. Can either be a simple string or an object with optional expandable details.{ text: "view your saved information", details: ["Your email", "Your name", "Your phone number"] }


trustedAuthTokenParams object

The trusted auth token params to use for the authorization flow.

trustedAuthToken string

The trusted auth token to be exchanged for a session.

tokenProfileId string

The ID of the token profile, from the Stytch Dashboard, to use for the authorization flow.

import React from 'react';
import { B2BIdentityProvider } from '@stytch/react/b2b';

const styles = { fontFamily: 'Arial' };

const MyComponent = () => {
  return <B2BIdentityProvider styles={styles} />;
};

export default MyComponent;

Trusted Auth Tokens

If your project is using Trusted Auth Tokens, they can be provided to the component as well. When trustedAuthTokenParams are supplied, the component will exchange the provided token for a session and automatically log the user in before starting the authorization flow.

To see all authentication and customization options, see the UI config section.

import React from 'react';
import { B2BIdentityProvider } from '@stytch/react/b2b';

const styles = { fontFamily: 'Arial' };

const trustedAuthTokenParams = {
  trustedAuthToken: 'eyJ...',
  tokenProfileID: 'token-profile-id',
};

const MyComponent = () => {
  return <B2BIdentityProvider styles={styles} trustedAuthTokenParams={trustedAuthTokenParams} />;
};

export default MyComponent;

Custom Consent Manifest Configuration

If your project has Custom Scopes configured, the Consent UI can be customized via the getIDPConsentManifest prop. Supply a custom manifest for fine-grained control over the wording used and grouping of the permissions being requested. If no getIDPConsentManifest function is defined, the description field for each scope will be used instead.

To see all authentication and customization options, see the UI config section.

import React from 'react';
import { B2BIdentityProvider } from '@stytch/react/b2b';

const styles = { fontFamily: 'Arial' };

const isProfileScope = (scope) => scope === 'openid' || scope === 'email' || scope === 'profile';
const isDataScope = (scope) => !isProfileScope(scope);

const getScopeDescription = (scope) => {
  switch (scope) {
    case 'openid':
      return 'Your account ID';
    case 'email':
      return 'Your email address';
    case 'profile':
      return 'Your name and profile';
    case 'read:data':
      return 'Read access to your data';
    case 'write:data':
      return 'Write access to your data';
    default:
      return `The ${scope} permission`;
  }
};

const getManifest = ({ scopes, clientName }) => [
  {
    header: `${clientName} wants to view your Profile`,
    items: [
      {
        text: 'View information stored in your Profile about your account and your user.',
        details: scopes.filter(isProfileScope).map(getScopeDescription),
      },
    ],
  },
  {
    header: `${clientName} wants to access your Data`,
    items: scopes.filter(isDataScope).map(getScopeDescription),
  },
];

const MyComponent = () => {
  return <B2BIdentityProvider styles={styles} getIDPConsentManifest={getManifest} />;
};

export default MyComponent;