Authenticates the OTP and returns an intermediate session token. Intermediate session tokens can be used for various Discovery login flows and are valid for 10 minutes.
Authenticate Discovery One-Time Passcode (OTP)
POST
https://test.stytch.com/v1/b2b/otps/email/discovery/authenticateBody parameters
email_address* string
code* string
Response fields
request_id string
status_code int
intermediate_session_token string
email_address string
discovered_organizations array
const stytch = require('stytch');
const client = new stytch.B2BClient({
project_id: 'PROJECT_ID',
secret: 'SECRET',
});
const params = {
email_address: "sandbox@stytch.com",
code: "123456",
};
client.otps.email.discovery.authenticate(params)
.then(resp => { console.log(resp) })
.catch(err => { console.log(err) });
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": [{...}, {...}]
}