Enchanted Link APIs

Overview

Using the Enchanted Link APIs enables users to sign in by clicking a link delivered to their email address. The email will include 3 different links, and the user will have to click the right one, based on the 2-digit number that is displayed when initiating the authentication process.

Read about Enchanted Link implementation types here

This implementation type has three phases:

  1. Initiate the process and send the enchanted link - this is initiated with the application sign-in or sign-up screens. T
  2. Poll for token verification and acquire the session and refresh tokens
  3. Verify the token

Note

The "Verify the token" phase happens in parallel and independent from the polling phase. As soon as it is done - the polling phase will result in the user sign-in details (session and refresh tokens).

Use Cases

  1. Sign up a new user
  2. Sign in an existing user
  3. Sign in with auto sign-up a new user if not exists
  4. Update user's email address
  5. Update user's phone number

Examples

Example - sign up

  1. Trigger the sign up process with the Sign-Up endpoint When action complete successfully, the body includes pendingRef and linkId. Show the linkId to the end user. An email will be generated with 3 different links and random numbers, one of them is the linkId.
  2. Regularly poll for the token verification, with the Poll Session endpoint. Use the pendingRef to identify the magic link you are waiting on. As soon as the user will click on the right link, and you call the "Verify Token" endpoint (#3 below), you will get the session and refresh tokens as a response.
  3. When the use clicks on the right link, call the Verify Token endpoint. When the token is validated, the endpoint will a successful code (200) and empty body.

Note

The example applies to all other use cases

Was this helpful?

On this page