openapi: 3.0.3
info:
title: Stytch B2B Authentication Application SSO API
version: 2.0.0
description: Stytch's B2B API for multi-tenant authentication. Supports Organizations, Members, SSO (SAML/OIDC), Magic Links, OTP, OAuth, Discovery, Sessions, B2B RBAC, SCIM, TOTP, Recovery Codes, Passwords, Impersonation, and the B2B IDP.
contact:
name: Stytch
url: https://stytch.com/docs
license:
name: Proprietary
servers:
- url: https://api.stytch.com
description: Production
- url: https://test.stytch.com
description: Test
tags:
- name: SSO
paths:
/v1/b2b/sso/{organization_id}:
get:
summary: Getconnections
operationId: api_sso_v1_GetConnections
tags:
- SSO
description: Get all SSO Connections owned by the organization.
parameters:
- name: organization_id
in: path
required: true
schema:
type: string
description: Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value. You may also use the organization_slug or organization_external_id here as a convenience.
description: Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value. You may also use the organization_slug or organization_external_id here as a convenience.
- name: X-Stytch-Member-Session
in: header
required: false
description: A Stytch session that can be used to run the request with the given member's permissions.
schema:
type: string
- name: X-Stytch-Member-SessionJWT
in: header
required: false
description: A Stytch Session JSON Web Token (JWT) that can be used to run the request with the given member's permissions.
schema:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/api_sso_v1_GetConnectionsResponse'
'400':
description: Bad request
'401':
description: Unauthorized
content:
application/json:
example:
status_code: 401
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: unauthorized_credentials
error_message: Unauthorized credentials.
error_url: https://stytch.com/docs/api/errors/401
'429':
description: Too Many Requests
content:
application/json:
example:
status_code: 429
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: too_many_requests
error_message: Too many requests have been made.
error_url: https://stytch.com/docs/api/errors/429
'500':
description: Internal server error
content:
application/json:
example:
status_code: 500
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: internal_server_error
error_message: Oops, something seems to have gone wrong, please reach out to support@stytch.com to let us know what went wrong.
error_url: https://stytch.com/docs/api/errors/500
x-code-samples:
- lang: csharp
label: C#
source: "// GET /v1/b2b/sso/{organization_id}\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n organization_id: \"${organizationId}\",\n};\n\nconst options = {\n authorization: {\n session_token: '${sessionToken}',\n },\n};\n\nclient.SSO.GetConnections(params, options)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: go
label: Go
source: "// GET /v1/b2b/sso/{organization_id}\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/stytchauth/stytch-go/v17/stytch/b2b/b2bstytchapi\"\n\t\"github.com/stytchauth/stytch-go/v17/stytch/b2b/sso\"\n\t\"github.com/stytchauth/stytch-go/v17/stytch/methodoptions\"\n)\n\nfunc main() {\n\tclient, err := b2bstytchapi.NewClient(\n\t\t\"${projectId}\",\n\t\t\"${secret}\",\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"error instantiating client: %v\", err)\n\t}\n\n\tparams := &sso.GetConnectionsParams{\n\t\tOrganizationID: \"${organizationId}\",\n\t}\n\n\toptions := &sso.GetConnectionsParamsOptions{\n\t\tAuthorization: methodoptions.Authorization{\n\t\t\tSessionToken: \"${sessionToken}\",\n\t\t},\n\t}\n\n\tresp, err := client.SSO.GetConnections(context.Background(), params, options)\n\tif err != nil {\n\t\tlog.Fatalf(\"error in method call: %v\", err)\n\t}\n\n\tlog.Println(resp)\n}\n"
- lang: java
label: Java
source: "// GET /v1/b2b/sso/{organization_id}\npackage com.example;\n\nimport com.stytch.java.b2b.models.sso.GetConnectionsRequest;\nimport com.stytch.java.b2b.models.sso.GetConnectionsRequestOptions;\nimport com.stytch.java.b2b.StytchB2BClient;\nimport com.stytch.java.common.methodoptions.Authorization;\nimport com.stytch.java.common.StytchResult;\n\npublic class Main {\n public static void main(String[] args) {\n StytchB2BClient.configure(\"${projectId}\", \"${secret}\");\n\n GetConnectionsRequest params = new GetConnectionsRequest();\n params.setOrganizationId(\"${organizationId}\");\n\n GetConnectionsRequestOptions options = new GetConnectionsRequestOptions();\n Authorization authorization = new Authorization();\n authorization.setSessionToken(\"${sessionToken}\");\n options.setAuthorization(authorization);\n\n Object result = StytchB2BClient.getSSO().getConnections(params, options);\n if (result instanceof StytchResult.Success) {\n System.out.println(((StytchResult.Success) result).getValue());\n } else {\n System.out.println(((StytchResult.Error) result).getException());\n }\n }\n}"
- lang: kotlin
label: Kotlin
source: "// GET /v1/b2b/sso/{organization_id}\npackage com.example\n\nimport com.stytch.java.b2b.StytchB2BClient\nimport com.stytch.java.b2b.models.sso.GetConnectionsRequest\nimport com.stytch.java.b2b.models.sso.GetConnectionsRequestOptions\nimport com.stytch.java.common.methodoptions.Authorization\n\nfun main() {\n StytchB2BClient.configure(\n projectId = \"${projectId}\",\n secret = \"${secret}\",\n )\n\n when (\n val result =\n StytchB2BClient.sso.getConnections(\n GetConnectionsRequest(\n organizationId = \"${organizationId}\",\n ),\n GetConnectionsRequestOptions(\n Authorization(\n sessionToken = \"${sessionToken}\",\n ),\n ),\n )\n ) {\n is StytchResult.Success -> println(result.value)\n is StytchResult.Error -> println(result.exception)\n }\n}\n"
- lang: javascript
label: Node.js
source: "// GET /v1/b2b/sso/{organization_id}\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n organization_id: \"${organizationId}\",\n};\n\nconst options = {\n authorization: {\n session_token: '${sessionToken}',\n },\n};\n\nclient.sso.getConnections(params, options)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: php
label: PHP
source: "$response = $client->sso->get_connections([\n 'organization_id' => '${organizationId}',\n], [\n 'authorization' => ['session_token' => '${sessionToken}'],\n\n]);"
- lang: python
label: Python
source: "# GET /v1/b2b/sso/{organization_id}\nfrom stytch import B2BClient\nfrom stytch.b2b.models.sso import GetConnectionsRequestOptions\nfrom stytch.shared.method_options import Authorization\n\nclient = B2BClient(\n project_id=\"${projectId}\",\n secret=\"${secret}\",\n)\n\nresp = client.sso.get_connections(\n organization_id=\"${organizationId}\",\n method_options=GetConnectionsRequestOptions(\n authorization=Authorization(\n session_token=\"${sessionToken}\",\n ),\n ),\n)\n\nprint(resp)\n"
- lang: ruby
label: Ruby
source: "# GET /v1/b2b/sso/{organization_id}\nrequire 'stytch'\n\nclient = StytchB2B::Client.new(\n project_id: \"${projectId}\",\n secret: \"${secret}\"\n)\n\nresp = client.sso.get_connections(\n organization_id: \"${organizationId}\",\n method_options: StytchB2B::SSO::GetConnectionsRequestOptions.new(\n authorization: Stytch::MethodOptions::Authorization.new(session_token: '${sessionToken}')\n )\n)\n\nputs resp"
- lang: rust
label: Rust
source: "// GET /v1/b2b/sso/{organization_id}\nuse stytch::b2b::client::Client;\nuse stytch::b2b::sso::GetConnectionsRequest;\n\nfn main() {\n let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n let resp = client.sso.get_connections(\n GetConnectionsRequest{\n organization_id: \"${organizationId}\",\n ..Default::default()\n }\n ).await;\n println!(\"The response is {:?}\", resp);\n}"
- lang: bash
label: cURL
source: "# GET /v1/b2b/sso/{organization_id}\ncurl --request GET \\\n --url https://test.stytch.com/v1/b2b/sso/${organizationId} \\\n -u '${projectId}:${secret}' \\\n -H 'Content-Type: application/json' \\\n -H \"X-Stytch-Member-Session: ${sessionToken}\""
/v1/b2b/sso/{organization_id}/connections/{connection_id}:
delete:
summary: Deleteconnection
operationId: api_sso_v1_DeleteConnection
tags:
- SSO
description: Delete an existing SSO connection.
parameters:
- name: organization_id
in: path
required: true
schema:
type: string
description: The organization ID that the SSO connection belongs to. You may also use the organization_slug or organization_external_id here as a convenience.
description: The organization ID that the SSO connection belongs to. You may also use the organization_slug or organization_external_id here as a convenience.
- name: connection_id
in: path
required: true
schema:
type: string
description: The ID of the SSO connection. SAML, OIDC, and External connection IDs can be provided.
description: The ID of the SSO connection. SAML, OIDC, and External connection IDs can be provided.
- name: X-Stytch-Member-Session
in: header
required: false
description: A Stytch session that can be used to run the request with the given member's permissions.
schema:
type: string
- name: X-Stytch-Member-SessionJWT
in: header
required: false
description: A Stytch Session JSON Web Token (JWT) that can be used to run the request with the given member's permissions.
schema:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/api_sso_v1_DeleteConnectionResponse'
'400':
description: Bad request
'401':
description: Unauthorized
content:
application/json:
example:
status_code: 401
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: unauthorized_credentials
error_message: Unauthorized credentials.
error_url: https://stytch.com/docs/api/errors/401
'429':
description: Too Many Requests
content:
application/json:
example:
status_code: 429
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: too_many_requests
error_message: Too many requests have been made.
error_url: https://stytch.com/docs/api/errors/429
'500':
description: Internal server error
content:
application/json:
example:
status_code: 500
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: internal_server_error
error_message: Oops, something seems to have gone wrong, please reach out to support@stytch.com to let us know what went wrong.
error_url: https://stytch.com/docs/api/errors/500
x-code-samples:
- lang: csharp
label: C#
source: "// DELETE /v1/b2b/sso/{organization_id}/connections/{connection_id}\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n organization_id: \"${organizationId}\",\n connection_id: \"${samlConnectionId}\",\n};\n\nconst options = {\n authorization: {\n session_token: '${sessionToken}',\n },\n};\n\nclient.SSO.DeleteConnection(params, options)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: go
label: Go
source: "// DELETE /v1/b2b/sso/{organization_id}/connections/{connection_id}\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/stytchauth/stytch-go/v17/stytch/b2b/b2bstytchapi\"\n\t\"github.com/stytchauth/stytch-go/v17/stytch/b2b/sso\"\n\t\"github.com/stytchauth/stytch-go/v17/stytch/methodoptions\"\n)\n\nfunc main() {\n\tclient, err := b2bstytchapi.NewClient(\n\t\t\"${projectId}\",\n\t\t\"${secret}\",\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"error instantiating client: %v\", err)\n\t}\n\n\tparams := &sso.DeleteConnectionParams{\n\t\tOrganizationID: \"${organizationId}\",\n\t\tConnectionID: \"${samlConnectionId}\",\n\t}\n\n\toptions := &sso.DeleteConnectionParamsOptions{\n\t\tAuthorization: methodoptions.Authorization{\n\t\t\tSessionToken: \"${sessionToken}\",\n\t\t},\n\t}\n\n\tresp, err := client.SSO.DeleteConnection(context.Background(), params, options)\n\tif err != nil {\n\t\tlog.Fatalf(\"error in method call: %v\", err)\n\t}\n\n\tlog.Println(resp)\n}\n"
- lang: java
label: Java
source: "// DELETE /v1/b2b/sso/{organization_id}/connections/{connection_id}\npackage com.example;\n\nimport com.stytch.java.b2b.models.sso.DeleteConnectionRequest;\nimport com.stytch.java.b2b.models.sso.DeleteConnectionRequestOptions;\nimport com.stytch.java.b2b.StytchB2BClient;\nimport com.stytch.java.common.methodoptions.Authorization;\nimport com.stytch.java.common.StytchResult;\n\npublic class Main {\n public static void main(String[] args) {\n StytchB2BClient.configure(\"${projectId}\", \"${secret}\");\n\n DeleteConnectionRequest params = new DeleteConnectionRequest();\n params.setOrganizationId(\"${organizationId}\");\n params.setConnectionId(\"${samlConnectionId}\");\n\n DeleteConnectionRequestOptions options = new DeleteConnectionRequestOptions();\n Authorization authorization = new Authorization();\n authorization.setSessionToken(\"${sessionToken}\");\n options.setAuthorization(authorization);\n\n Object result = StytchB2BClient.getSSO().deleteConnection(params, options);\n if (result instanceof StytchResult.Success) {\n System.out.println(((StytchResult.Success) result).getValue());\n } else {\n System.out.println(((StytchResult.Error) result).getException());\n }\n }\n}"
- lang: kotlin
label: Kotlin
source: "// DELETE /v1/b2b/sso/{organization_id}/connections/{connection_id}\npackage com.example\n\nimport com.stytch.java.b2b.StytchB2BClient\nimport com.stytch.java.b2b.models.sso.DeleteConnectionRequest\nimport com.stytch.java.b2b.models.sso.DeleteConnectionRequestOptions\nimport com.stytch.java.common.methodoptions.Authorization\n\nfun main() {\n StytchB2BClient.configure(\n projectId = \"${projectId}\",\n secret = \"${secret}\",\n )\n\n when (\n val result =\n StytchB2BClient.sso.deleteConnection(\n DeleteConnectionRequest(\n organizationId = \"${organizationId}\",\n connectionId = \"${samlConnectionId}\",\n ),\n DeleteConnectionRequestOptions(\n Authorization(\n sessionToken = \"${sessionToken}\",\n ),\n ),\n )\n ) {\n is StytchResult.Success -> println(result.value)\n is StytchResult.Error -> println(result.exception)\n }\n}\n"
- lang: javascript
label: Node.js
source: "// DELETE /v1/b2b/sso/{organization_id}/connections/{connection_id}\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n organization_id: \"${organizationId}\",\n connection_id: \"${samlConnectionId}\",\n};\n\nconst options = {\n authorization: {\n session_token: '${sessionToken}',\n },\n};\n\nclient.sso.deleteConnection(params, options)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: php
label: PHP
source: "$response = $client->sso->delete_connection([\n 'organization_id' => '${organizationId}',\n 'connection_id' => '${samlConnectionId}',\n], [\n 'authorization' => ['session_token' => '${sessionToken}'],\n\n]);"
- lang: python
label: Python
source: "# DELETE /v1/b2b/sso/{organization_id}/connections/{connection_id}\nfrom stytch import B2BClient\nfrom stytch.b2b.models.sso import DeleteConnectionRequestOptions\nfrom stytch.shared.method_options import Authorization\n\nclient = B2BClient(\n project_id=\"${projectId}\",\n secret=\"${secret}\",\n)\n\nresp = client.sso.delete_connection(\n organization_id=\"${organizationId}\",\n connection_id=\"${samlConnectionId}\",\n method_options=DeleteConnectionRequestOptions(\n authorization=Authorization(\n session_token=\"${sessionToken}\",\n ),\n ),\n)\n\nprint(resp)\n"
- lang: ruby
label: Ruby
source: "# DELETE /v1/b2b/sso/{organization_id}/connections/{connection_id}\nrequire 'stytch'\n\nclient = StytchB2B::Client.new(\n project_id: \"${projectId}\",\n secret: \"${secret}\"\n)\n\nresp = client.sso.delete_connection(\n organization_id: \"${organizationId}\",\n connection_id: \"${samlConnectionId}\",\n method_options: StytchB2B::SSO::DeleteConnectionRequestOptions.new(\n authorization: Stytch::MethodOptions::Authorization.new(session_token: '${sessionToken}')\n )\n)\n\nputs resp"
- lang: rust
label: Rust
source: "// DELETE /v1/b2b/sso/{organization_id}/connections/{connection_id}\nuse stytch::b2b::client::Client;\nuse stytch::b2b::sso::DeleteConnectionRequest;\n\nfn main() {\n let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n let resp = client.sso.delete_connection(\n DeleteConnectionRequest{\n organization_id: \"${organizationId}\",\n connection_id: \"${samlConnectionId}\",\n ..Default::default()\n }\n ).await;\n println!(\"The response is {:?}\", resp);\n}"
- lang: bash
label: cURL
source: "# DELETE /v1/b2b/sso/{organization_id}/connections/{connection_id}\ncurl --request DELETE \\\n --url https://test.stytch.com/v1/b2b/sso/${organizationId}/connections/${samlConnectionId} \\\n -u '${projectId}:${secret}' \\\n -H 'Content-Type: application/json' \\\n -H \"X-Stytch-Member-Session: ${sessionToken}\""
/v1/b2b/sso/authenticate:
post:
summary: Authenticate
operationId: api_sso_v1_Authenticate
tags:
- SSO
description: "Authenticate a user given a token. \nThis endpoint verifies that the user completed the SSO Authentication flow by verifying that the token is valid and hasn't expired.\nProvide the `session_duration_minutes` parameter to set the lifetime of the session. \nIf the `session_duration_minutes` parameter is not specified, a Stytch session will be created with a 60 minute duration.\nTo link this authentication event to an existing Stytch session, include either the `session_token` or `session_jwt` param.\n\nIf the Member is required to complete MFA to log in to the Organization, the returned value of `member_authenticated` will be `false`, and an `intermediate_session_token` will be returned.\nThe `intermediate_session_token` can be passed into the [OTP SMS Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-otp-sms), [TOTP Authenticate endpoint](https://stytch.com/docs/b2b/api/authenticate-totp),\nor [Recovery Codes Recover endpoint](https://stytch.com/docs/b2b/api/recovery-codes-recover) to complete the MFA step and acquire a full member session.\nThe `session_duration_minutes` and `session_custom_claims` parameters will be ignored.\n\nIf a valid `session_token` or `session_jwt` is passed in, the Member will not be required to complete an MFA step."
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/api_sso_v1_AuthenticateRequest'
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/api_sso_v1_AuthenticateResponse'
'400':
description: Bad request
'401':
description: Unauthorized
content:
application/json:
example:
status_code: 401
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: unauthorized_credentials
error_message: Unauthorized credentials.
error_url: https://stytch.com/docs/api/errors/401
'429':
description: Too Many Requests
content:
application/json:
example:
status_code: 429
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: too_many_requests
error_message: Too many requests have been made.
error_url: https://stytch.com/docs/api/errors/429
'500':
description: Internal server error
content:
application/json:
example:
status_code: 500
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: internal_server_error
error_message: Oops, something seems to have gone wrong, please reach out to support@stytch.com to let us know what went wrong.
error_url: https://stytch.com/docs/api/errors/500
x-code-samples:
- lang: csharp
label: C#
source: "// POST /v1/b2b/sso/authenticate\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n sso_token: \"${token}\",\n};\n\nclient.SSO.Authenticate(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: go
label: Go
source: "// POST /v1/b2b/sso/authenticate\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/stytchauth/stytch-go/v17/stytch/b2b/b2bstytchapi\"\n\t\"github.com/stytchauth/stytch-go/v17/stytch/b2b/sso\"\n)\n\nfunc main() {\n\tclient, err := b2bstytchapi.NewClient(\n\t\t\"${projectId}\",\n\t\t\"${secret}\",\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"error instantiating client: %v\", err)\n\t}\n\n\tparams := &sso.AuthenticateParams{\n\t\tSSOToken: \"${token}\",\n\t}\n\n\tresp, err := client.SSO.Authenticate(context.Background(), params)\n\tif err != nil {\n\t\tlog.Fatalf(\"error in method call: %v\", err)\n\t}\n\n\tlog.Println(resp)\n}\n"
- lang: java
label: Java
source: "// POST /v1/b2b/sso/authenticate\npackage com.example;\n\nimport com.stytch.java.b2b.models.sso.AuthenticateRequest;\nimport com.stytch.java.b2b.StytchB2BClient;\nimport com.stytch.java.common.StytchResult;\n\npublic class Main {\n public static void main(String[] args) {\n StytchB2BClient.configure(\"${projectId}\", \"${secret}\");\n\n AuthenticateRequest params = new AuthenticateRequest();\n params.setSSOToken(\"${token}\");\n\n Object result = StytchB2BClient.getSSO().authenticate(params);\n if (result instanceof StytchResult.Success) {\n System.out.println(((StytchResult.Success) result).getValue());\n } else {\n System.out.println(((StytchResult.Error) result).getException());\n }\n }\n}"
- lang: kotlin
label: Kotlin
source: "// POST /v1/b2b/sso/authenticate\npackage com.example\n\nimport com.stytch.java.b2b.StytchB2BClient\nimport com.stytch.java.b2b.models.sso.AuthenticateRequest\n\nfun main() {\n StytchB2BClient.configure(\n projectId = \"${projectId}\",\n secret = \"${secret}\",\n )\n\n when (\n val result =\n StytchB2BClient.sso.authenticate(\n AuthenticateRequest(\n ssoToken = \"${token}\",\n ),\n )\n ) {\n is StytchResult.Success -> println(result.value)\n is StytchResult.Error -> println(result.exception)\n }\n}\n"
- lang: javascript
label: Node.js
source: "// POST /v1/b2b/sso/authenticate\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n sso_token: \"${token}\",\n};\n\nclient.sso.authenticate(params)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: php
label: PHP
source: "$response = $client->sso->authenticate([\n 'sso_token' => '${token}',\n]);"
- lang: python
label: Python
source: "# POST /v1/b2b/sso/authenticate\nfrom stytch import B2BClient\n\nclient = B2BClient(\n project_id=\"${projectId}\",\n secret=\"${secret}\",\n)\n\nresp = client.sso.authenticate(\n sso_token=\"${token}\",\n)\n\nprint(resp)\n"
- lang: ruby
label: Ruby
source: "# POST /v1/b2b/sso/authenticate\nrequire 'stytch'\n\nclient = StytchB2B::Client.new(\n project_id: \"${projectId}\",\n secret: \"${secret}\"\n)\n\nresp = client.sso.authenticate(\n sso_token: \"${token}\"\n \n)\n\nputs resp"
- lang: rust
label: Rust
source: "// POST /v1/b2b/sso/authenticate\nuse stytch::b2b::client::Client;\nuse stytch::b2b::sso::AuthenticateRequest;\n\nfn main() {\n let client = Client::new(\"${projectId}\", \"${secret}\").unwrap();\n let resp = client.sso.authenticate(\n AuthenticateRequest{\n sso_token: \"${token}\",\n ..Default::default()\n }\n ).await;\n println!(\"The response is {:?}\", resp);\n}"
- lang: bash
label: cURL
source: "# POST /v1/b2b/sso/authenticate\ncurl --request POST \\\n --url https://test.stytch.com/v1/b2b/sso/authenticate \\\n -u '${projectId}:${secret}' \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"sso_token\": \"${token}\"\n }'"
/v1/b2b/sso/oidc/{organization_id}:
post:
summary: Createconnection
operationId: api_sso_v1_sso_oidc_CreateConnection
tags:
- SSO
description: Create a new OIDC Connection.
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/api_sso_v1_sso_oidc_CreateConnectionRequest'
parameters:
- name: organization_id
in: path
required: true
schema:
type: string
description: Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value. You may also use the organization_slug or organization_external_id here as a convenience.
description: Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to perform operations on an Organization, so be sure to preserve this value. You may also use the organization_slug or organization_external_id here as a convenience.
- name: X-Stytch-Member-Session
in: header
required: false
description: A Stytch session that can be used to run the request with the given member's permissions.
schema:
type: string
- name: X-Stytch-Member-SessionJWT
in: header
required: false
description: A Stytch Session JSON Web Token (JWT) that can be used to run the request with the given member's permissions.
schema:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/api_sso_v1_sso_oidc_CreateConnectionResponse'
'400':
description: Bad request
'401':
description: Unauthorized
content:
application/json:
example:
status_code: 401
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: unauthorized_credentials
error_message: Unauthorized credentials.
error_url: https://stytch.com/docs/api/errors/401
'429':
description: Too Many Requests
content:
application/json:
example:
status_code: 429
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: too_many_requests
error_message: Too many requests have been made.
error_url: https://stytch.com/docs/api/errors/429
'500':
description: Internal server error
content:
application/json:
example:
status_code: 500
request_id: request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141
error_type: internal_server_error
error_message: Oops, something seems to have gone wrong, please reach out to support@stytch.com to let us know what went wrong.
error_url: https://stytch.com/docs/api/errors/500
x-code-samples:
- lang: csharp
label: C#
source: "// POST /v1/b2b/sso/oidc/{organization_id}\nconst stytch = require('stytch');\n\nconst client = new stytch.B2BClient({\n project_id: '${projectId}',\n secret: '${secret}',\n});\n\nconst params = {\n organization_id: \"${organizationId}\",\n display_name: \"Example OIDC connection\",\n};\n\nconst options = {\n authorization: {\n session_token: '${sessionToken}',\n },\n};\n\nclient.SSO.OIDC.CreateConnection(params, options)\n .then(resp => { console.log(resp) })\n .catch(err => { console.log(err) });"
- lang: go
label: Go
source: "// POST /v1/b2b/sso/oidc/{organization_id}\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/stytchauth/stytch-go/v17/stytch/b2b/b2bstytchapi\"\n\t\"github.com/stytchauth/stytch-go/v17/stytch/b2b/sso/oidc\"\n\t\"github.com/stytchauth/stytch-go/v17/stytch/methodoptions\"\n)\n\nfunc main() {\n\tclient, err := b2bstytchapi.NewClient(\n\t\t\"${projectId}\",\n\t\t\"${secret}\",\n\t)\n\tif err != nil {\n\t\tlog.Fatalf(\"error instantiating client: %v\", err)\n\t}\n\n\tparams := &oidc.CreateConnectionParams{\n\t\tOrganizationID: \"${organizationId}\",\n\t\tDisplayName: \"Example OIDC connection\",\n\t}\n\n\toptions := &oidc.CreateConnectionParamsOptions{\n\t\tAuthorization: methodoptions.Authorization{\n\t\t\tSessionToken: \"${sessionToken}\",\n\t\t},\n\t}\n\n\tresp, err := client.SSO.OIDC.CreateConnection(context.Background(), params, options)
# --- truncated at 32 KB (237 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/stytch/refs/heads/main/openapi/stytch-sso-api-openapi.yml