Magic Link with Flows

This guide will walk you through integrating magic link based authentication into your Descope Flows. Magic Links allow your users to authenticate with a single click of a button, sent directly to their email address or phone number.

Magic Link starts the session in a new tab after polling completes. If you wish to start the user session in the existing tab, check out Enchanted Link instead.

Flow Actions

When using Magic Link, you have the standard actions for most authentication methods available.

  • Sign Up / Magic Link - Signs the user up, but will not work if user already exists
  • Sign Up or In / Magic Link - Signs the user in, and if user doesn't exist it will automatically sign them up
  • Sign In / Magic Link - Signs the user in, but if the user doesn't exist it will fail.
  • Update User / Magic Link - Will merge Magic Link identity to an existing user

To learn more about Actions in general, you can refer to our guide on them.

Most of these actions are pretty simple, and you can drop them in your application like any other Action.

This is an example of using the Sign Up or In action in a flow:

sign-up-or-in-flow-action

Flow Screens

When using Magic Link, there will typically be a screen present for polling, with a horizontal scrolling sidebar, as part of the actions listed above. All you need to do to use magic links, is to connect the actions to a screen that has a Custom Login ID, Email, or Phone input.

magic-link-polling

There's also a way of knowing where the user started the flow, so once successfully authenticated, a Descoper can add the user agent's name using the context key userAgent. You can add this in your "Verified Successfully" screen of your flow.

magic-link-user-agent

magic-link-user-agent-screen

Error Handling

Error handling is handled like any other action. You can refer to our Flow Error Handling guide for more details.

Was this helpful?

On this page