B2B Saas Authentication

/

Frontend SDKs

/

Headless

/

SSO

/

Create OIDC Connection

Create OIDC Connection

The Create OIDC Connection method wraps the Create OIDC Connection API endpoint. The organization_id will be automatically inferred from the logged-in Member's session. This method cannot be used to create OIDC connections in other Organizations.


Method parameters


display_namestring

identity_providerstring

Response fields


request_idstring

status_codeint

connectionobject
import { useStytchB2BClient } from '@stytch/react/b2b';

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

  const createOIDCConnection = () => {
    stytch.sso.oidc.createConnection({
      display_name: 'Example OIDC connection',
    });
  };

  return <button onClick={createOIDCConnection}>Create an OIDC Connection</button>;
};

RESPONSE

200
{
  "connection": {
    "organization_id": "organization-test-07971b06-ac8b-4cdb-9c15-63b17e653931",
    "connection_id": "oidc-connection-test-b6c714c2-7413-4b92-a0f1-97aa1085aeff",
    "display_name": "Example OIDC Connection",
    "redirect_url": "https://test.stytch.com/v1/b2b/sso/callback/oidc-connection-test-b6c714c2-7413-4b92-a0f1-97aa1085aeff",
    "status": "active",
    "issuer": "https://idp.example.com/",
    "client_id": "s6BhdRkqt3",
    "client_secret": "SeiGwdj5lKkrEVgcEY3QNJXt6srxS3IK2Nwkar6mXD4=",
    "authorization_url": "https://idp.example.com/authorize",
    "token_url": "https://idp.example.com/oauth2/token",
    "userinfo_url": "https://idp.example.com/userinfo",
    "jwks_url": "https://idp.example.com/oauth2/jwks",
    "identity_provider": "generic"
    },
  "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
  "status_code": 200
}