Skip to main content
import { Text, TouchableOpacity, View } from 'react-native';
import { useStytch } from '@stytch/react-native';

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

const sendEmailMagicLink = () => {
  stytch.magicLinks.email.send('sandbox@stytch.com', {
    login_magic_link_url: 'https://example.com/authenticate',
    login_expiration_minutes: 60,
  });
};

return (
  <View>
    <TouchableOpacity onPress={sendEmailMagicLink}>
      <Text>Send email</Text>
    </TouchableOpacity>
  </View>
);
};
{
    "status_code": 200,
    "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141"
}
The Send method wraps the send Email Magic Link API endpoint. This method requires that the user already exist within Stytch before a magic link may be sent. This method is useful for gating your login flow to only pre-created users, e.g. an invite or waitlist. This method is also used when you need to add an email address to an existing Stytch User. If there is a currently valid Stytch session, and the user inputs an email address that does not match one on their Stytch User object, upon successful authentication the new email address will be appended to the emails array. Note, this does expose a potential account enumeration vector, see our article on preventing account enumeration for more details.

Parameters

email
string
required
The email address of the User to send the Magic Link to.
Configuration
object
Additional configuration.

Response

request_id
string
Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
status_code
number
The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.