- Capture the user identifier in your application (the user’s email or phone number) and invoke the
/passwordless/startendpoint to initiate the passwordless flow. The user will get an email, an SMS with a one-time-use code, or a magic link. - If you did not send a magic link, prompt the user for the one-time-use code, and call the
/oauth/tokenendpoint to get authentication tokens.
/oauth/token. The user will click the magic link and be redirected to the application’s callback URL.
Below, we list a few code snippets that can be used to call these API endpoints for different scenarios.
Send a one-time-use code via email
Send a magic link via email
You need to specify send: link.
Send a one-time-use password via SMS
Authenticate an SMS user
Authenticate an Email user
Authenticate a user through a magic link
When you send a magic link, you don’t need to call an API to authenticate the user. Users will click the link and be redirected to the callback URL.
Setting the auth0-forwarded-for header for rate-limit purposes
The/passwordless/start endpoint has a rate limit of 50 requests per hour per IP. If you call the API from the server-side, your backend’s IP may easily hit these rate limits. To learn how to address this issue, read the Rate Limiting in Passwordless Endpoints section of Using Passwordless APIs.
Customize MFA
Customizable MFA with the Resource Owner Password Grant, Embedded, or Refresh Token flows is in Early Access. By using this feature, you agree to the applicable Free Trial terms in Okta’s Master Subscription Agreement. To learn more, read Product Release Stages. To participate in the early access, contact Auth0 Support.
oauth/token endpoint returns the mfa_required error and includes the mfa_token you need to use the MFA API and mfa_requirements parameter with a list of authenticators your application currently supports:
mfa_token to call the mfa/authenticator endpoint to list all factors the user has enrolled and match the same type your application supports. You also need to obtain the matching authenticator_type to issue challenges:
request/mfa/challenge endpoint.
Further customize your MFA flow with Auth0 Actions. To learn more, read Actions Triggers: post-challenge - API Object.