Wraps Stytch's login_or_create via email API endpoint. Call this method to send an email passcode to new or existing users.
Login or create via email
Method parameters
email* string
Configuration object
Additional configuration.
expiration_minutes int
login_template_id string
signup_template_id string
locale string
import React, { useCallback } from 'react';
import { useStytch } from '@stytch/react';
export const Login = () => {
const stytch = useStytch();
const sendPasscode = useCallback(() => {
stytch.otps.email.loginOrCreate('sandbox@stytch.com', {
expiration_minutes: 5,
});
}, [stytch]);
return <button onClick={sendPasscode}>Send passcode</button>;
};
RESPONSE
200
{
"status_code": 200,
"request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
"method_id": "email-test-81bf03a8-86e1-4d95-bd44-bb3495224953"
}