Exchange an auth token issued by a trusted identity provider for a Stytch session. You must first register a Trusted Auth Token profile in the Stytch dashboard here. If a session token or session JWT is provided, it will add the trusted auth token as an authentication factor to the existing session.
Attest Session
POST
https://test.stytch.com/v1/b2b/sessions/attestBody parameters
profile_id* string
token* string
organization_id* string
session_duration_minutes int
session_custom_claims map<string, any>
session_jwt string
session_token string
Response fields
status_code int
request_id string
member_session object
organization object
session_jwt string
session_token string
member_id string
member object
const stytch = require('stytch');
const client = new stytch.B2BClient({
project_id: 'PROJECT_ID',
secret: 'SECRET',
});
const params = {
organization_id: "organization-test-07971b06-ac8b-4cdb-9c15-63b17e653931",
profile_id: "trusted-auth-token-profile-test-41920359-8bbb-4fe8-8fa3-aaa83f35f02c",
token: "eyJhb...",
};
client.sessions.attest(params)
.then(resp => { console.log(resp) })
.catch(err => { console.log(err) });
RESPONSE
200
{
"status_code": 200,
"request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
"member_id": "member-test-32fc5024-9c09-4da3-bd2e-c9ce4da9375f",
"session_jwt": "eyJ...",
"session_token": "mZAYn5aLEqKUlZ_Ad9U_fWr38GaAQ1oFAhT8ds245v7Q",
"member": {...},
"member_session": {...},
"organization": {...},
}