The authenticate method wraps the Discovery Authenticate Password API endpoint. This endpoint verifies that the email has a password currently set, and that the entered password is correct.
Authenticate
Method parameters
password* string
email_address* string
Response fields
request_id string
status_code int
email_address string
discovered_organizations array
intermediate_session_token string
import React, { useCallback } from 'react';
import { useStytchB2BClient } from '@stytch/react/b2b';
export const Login = () => {
const stytch = useStytchB2BClient();
const authenticatePassword = useCallback(() => {
stytch.passwords.discovery.authenticate({
email_address: 'sandbox@stytch.com',
password: 'SKHsKhEHkl%*j7nU',
});
}, [stytch]);
return <button onClick={authenticatePassword}>Authenticate Password</button>;
};
RESPONSE
200
{
"status_code": 200,
"request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
"discovered_organizations": [],
"intermediate_session_token": "",
"email_address": "sandbox@stytch.com",
}