The Create External Connection method wraps the Create External Connection API endpoint. The organization_id will be automatically inferred from the logged-in Member's session. This method cannot be used to create External connections in other Organizations.
Create External Connection
Method parameters
display_name string
external_organization_id* string
external_connection_id* string
Response fields
request_id string
status_code int
connection object
import { useStytchB2BClient } from '@stytch/react/b2b';
export const CreateExternalConnection = () => {
const stytch = useStytchB2BClient();
const createExternalConnection = () => {
stytch.sso.external.createConnection({
display_name: 'Example External connection',
external_organization_id: 'organization-test-ca6dbe77-10e5-4403-805a-b117c55c24c6',
external_connection_id: 'saml-connection-test-51861cbc-d3b9-428b-9761-227f5fb12be9',
});
};
return <button onClick={createExternalConnection}>Create an External Connection</button>;
};
RESPONSE
200
{
"connection": {
"connection_id": "external-connection-test-5c44cc6a-8af7-48d6-8da7-ea821342f5a6",
"display_name": "Example External Connection",
"organization_id": "organization-test-07971b06-ac8b-4cdb-9c15-63b17e653931",
"external_organization_id": "organization-test-ca6dbe77-10e5-4403-805a-b117c55c24c6",
"external_connection_id": "saml-connection-test-51861cbc-d3b9-428b-9761-227f5fb12be9",
"status": "active",
},
"request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
"status_code": 200
}