B2B Saas Authentication

/

API reference

/

OAuth

/

Discovery

/

Authenticate discovery OAuth

Authenticate Discovery OAuth

POSThttps://test.stytch.com/v1/b2b/oauth/discovery/authenticate

Authenticates the Discovery OAuth token and exchanges it for an Intermediate Session Token. Intermediate Session Tokens can be used for various Discovery login flows and are valid for 10 minutes.


Body parameters


discovery_oauth_token*string

pkce_code_verifierstring

Response fields


request_idstring

status_codeint

intermediate_session_tokenstring

email_addressstring

discovered_organizationsarray

provider_typestring

provider_tenant_idstring

provider_tenant_idsarray[string]
curl --request POST \
  --url https://test.stytch.com/v1/b2b/oauth/discovery/authenticate \
  -u 'PROJECT_ID:SECRET' \
  -H 'Content-Type: application/json' \
  -d '{
    "discovery_oauth_token": "hdPVZHHX0UoRa7hJTuuPHi1vlddffSnoweRbVFf5-H8g"
  }'

RESPONSE

200
{
	"request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
	"status_code": 200,
	"intermediate_session_token": "SeiGwdj5lKkrEVgcEY3QNJXt6srxS3IK2Nwkar6mXD4=",
	"email_address": "sandbox@stytch.com",
	"discovered_organizations": [{...}, {...}],
	"provider_type": "Github",
	"provider_tenant_id": "1234567",
	"provider_tenant_ids": ["1234567"]
}

Common Error Types