B2B Saas Authentication

/

Frontend SDKs

/

Headless

/

Email One-time Passcodes (OTPs)

/

Login or Signup

Login or signup

The Login or signup method wraps the login or signup Email OTP API endpoint.


Method parameters


organization_id*string

email_address*string

login_template_idstring

signup_template_idstring

localestring
import { useStytchB2BClient } from '@stytch/react/b2b';

export const Login = () => {
  const stytch = useStytchB2BClient();

  const sendEmailOTP = () => {
    stytch.otps.email.loginOrSignup({
      email_address: 'sandbox@stytch.com',
      organization_id: 'organization-test-07971b06-ac8b-4cdb-9c15-63b17e653931',
    });
  };

  return <button onClick={sendEmailOTP}>Send email OTP</button>;
};

RESPONSE

200
{
    "status_code": 200,
    "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141"
  }