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.
Related
- Authentication — every mutation.
