Clerk logo

Clerk Docs

Ctrl + K
Go to

Embeddable magic links

Learn how to build custom magic link flows to increase user engagement and reduce drop off in transactional emails, SMSs and anywhere else you can imagine.


A "magic link" is a link, that when pressed, will automatically authenticate your user, so that they can quickly perform some action on your site with less friction than if they had to sign in manually.

Common use cases include:

  • Welcome emails, when users are added off a waitlist.
  • Promotional emails for users.
  • Recovering abandoned carts.
  • Surveys or questionnaires

Embeddable magic links leverage sign-in tokens which can be created from your backend.

Create a sign in token

This will return a token, which can then be embedded as a query param in any link, something like:

Once you have the link, this can be embedded anywhere, such as an email.

Now that you have a way to process a token, you'll need to setup a page on your frontend to get the token from the query string, call the sign in function, then perform whatever action you originally had in mind.

Signing a user in with a token is very similar to all of our other custom flows.

React pseudo-code

Sign the user in

Complete NextJS example

NextJS complete page

Was this helpful?

Clerk © 2022