How to authenticate with a magic link
This guide shows you how to sign a user in through an email address, with no password.
1. Send the email
mutation {
magicLinkSend(input: {
email: "user@example.com"
redirectUrl: "https://app.example.com/auth/verify"
}) {
success
}
}The user receives an email with a six-digit code and a sign-in link. The mutation does not
create an account. For an address with no account, it returns success: true and sends no
email.
If you send a second request for the same address soon after the first, the mutation
returns success: true and sends no new email. The code in the first email stays valid.
2. Verify the code
mutation {
magicLinkVerify(input: {
email: "user@example.com"
token: "123456"
}) {
session { accessToken refreshToken }
}
}Put the six-digit code from the email in token.
API and MCP
You can also do this task with the Management API, the MCP server, or code that you send to picked_run.
| Task | GraphQL | MCP tool | Run |
|---|---|---|---|
| Send the email | magicLinkSend | None | None |
| Verify the code | magicLinkVerify | None | None |
Related
- Authentication — every mutation.
