B2B Saas Authentication

/

Frontend SDKs

/

Headless

/

Email Magic Links

/

Login or Signup

Login or signup

The loginOrSignup method wraps the login or signup Email magic link API endpoint.


Method parameters


organization_id*string

email_address*string

login_redirect_urlstring

signup_redirect_urlstring

login_template_idstring

signup_template_idstring

localestring

Response fields


request_idstring

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

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

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

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

RESPONSE

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