B2B Saas Authentication

/

Frontend SDKs

/

Headless

/

Passwords

/

Discovery

/

Authenticate

Authenticate

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.


Method parameters


password*string

email_address*string

Response fields


request_idstring

status_codeint

email_addressstring

discovered_organizationsarray

intermediate_session_tokenstring
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: 'xuEvs9sBi8I4x8rCXJPZ',
    });
  }, [stytch]);

  return <button onClick={authenticatePassword}>Authenticate Password</button>;
};
RESPONSE
{
    "status_code": 200,
    "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
    "discovered_organizations": [],
    "intermediate_session_token": "",
    "email_address": "sandbox@stytch.com",
}