The Login or create method wraps the Login or Create Email Magic Link API endpoint.
Login or create
Method parameters
email* string
Configuration object
Additional configuration.
login_magic_link_url string
signup_magic_link_url string
login_expiration_minutes int
signup_expiration_minutes int
login_template_id string
signup_template_id string
locale string
Response fields
request_id string
status_code int
import { useStytch } from '@stytch/react';
export const Login = () => {
const stytch = useStytch();
const sendEmailMagicLink = () => {
stytch.magicLinks.email.loginOrCreate('sandbox@stytch.com', {
login_magic_link_url: 'https://example.com/authenticate',
login_expiration_minutes: 60,
signup_magic_link_url: 'https://example.com/authenticate',
signup_expiration_minutes: 60,
});
};
return <button onClick={sendEmailMagicLink}>Send email</button>;
};
RESPONSE
200
{
"status_code": 200,
"request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141"
}