Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Magic link or sign-in code not working: how to find and fix it

CNV-396High impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

Passwordless sign-in lets people log in without a password. You enter your email, and the app sends a magic link (a one-time URL) or a sign-in code (a short number to type in). The step is simple, but it relies on email delivery, a token (a secret value that proves the request), and a clock.

It is broken when any of these happens: the email is not sent, it lands in spam or arrives late, the link says it has expired, the link works for a scanner but not for the person, or the code is rejected even though it was typed correctly.

Why it costs you leads or sales

With passwordless sign-in, the email is the door. If it does not open, there is no fallback for the user. New signups cannot reach onboarding, trial users cannot return, and paying customers cannot reach the product. Many will not retry more than once or twice, and some will contact support or leave.

Where a passwordless login breaks
  1. Enter emailForm submits
  2. Email sentLink or code leaves your provider
  3. Open link or type codeToken must still be valid
  4. Signed inSession created
  5. Onboarding or appActivation

If the email never arrives, every step after it is lost.

Sign-in attempts that reach the appExample numbers
Sign-in attempts that reach the app (example)Healthy email and link: 92 %; Email delayed 5+ minutes: 55 %; Link expires too soon: 30 %; Email never sent: 0 %035719255300Healthy email and linkEmail delayed 5+ minu…Link expires too soonEmail never sent%

Example: of 100 sign-in attempts, how many get in when the email is healthy versus when it is delayed or the link expires too soon. Numbers are illustrative.

How to check if your site has it

Test the whole path yourself, then look at the logs. Do it with a fresh address you can read, and repeat with a Gmail, an Outlook and a work address, because filtering differs.

Manual checks
  • Request a link or code and time how long the email takes to arrive.
  • Check spam, junk and promotions folders.
  • Look at your email provider's logs for the message: sent, delivered, bounced, deferred or blocked.
  • Click the link immediately, then again after the stated lifetime, and note the message you see.
  • Click the link twice. Does the second click fail even though the first one only loaded a page?
  • Request two codes in a row and try the first one. Many systems invalidate the earlier code.
  • Open the link in a different browser or on a phone. Some apps tie the token to the browser that asked for it.
  • Test with a corporate address that uses a mail security scanner.
Symptoms and likely causes
What the user seesLikely cause
No email at allProvider error, unverified sending domain, suppressed address, rate limit, or the send job failed
Email arrives in spamMissing SPF, DKIM or DMARC, or a shared sending IP with a poor reputation
Email arrives lateQueue backlog, greylisting, or a slow transactional provider
Link says expired right awayMail scanner opened the link first and used the single-use token, or the lifetime is very short, or server clocks differ
Code rejectedNewer code replaced it, wrong case or spaces, attempt limit reached, or the code was sent for a different session
Link opens but returns to loginCookie not set because the link opens in a different browser or domain

How to fix it

Fix the three failure points in order
  1. Confirm the email leaves your system

    Find the message in your transactional email provider or auth provider logs. If it is missing, fix the send error. If it is bounced or suppressed, remove the address from the suppression list and find why it was added.

  2. Authenticate your sending domain

    Publish SPF and DKIM records for the domain you send from, and add a DMARC record. Send from a real address on that domain, not a free mailbox address.

  3. Make the email simple and quick

    Send the sign-in email immediately, not in a batch. Use a plain subject such as 'Your sign-in link', put the code in the body in large text, and avoid heavy images.

  4. Set a sensible lifetime

    Give links and codes a lifetime long enough for slow inboxes, for example 15 to 60 minutes, and say the lifetime in the email. Keep it short enough to stay safe.

  5. Stop scanners from using up the link

    Make the link open a page with a 'Sign in' button that sends a POST request, rather than signing the user in on a plain GET. Scanners usually fetch URLs but do not press buttons.

  6. Be kind with codes

    Trim spaces, ignore case for letters, allow a few attempts, and when a new code is sent, tell the user the old one no longer works. Offer a 'Send a new code' button.

  7. Let the link work in any browser

    Do not require the same browser or device that requested it, or show a clear message and offer a code as a fallback.

Where to change the settings
  1. Check the plugin that sends the link

    Open the passwordless or login plugin settings and look for token lifetime and email template options. Names vary by plugin.

  2. Fix delivery

    WordPress sends mail through PHP by default, which is often filtered. Install an SMTP or transactional email plugin from your provider and send a test email from its settings page.

Confirm page so scanners cannot use the linkhtml
<form method="post" action="/auth/magic/confirm">
  <input type="hidden" name="token" value="{{ token }}">
  <button type="submit">Sign in</button>
</form>
Magic link behaviour

Broken

  • Link signs in on a plain page load
  • Scanner opens it first and uses it up
  • User sees 'link expired'
  • No way to ask for a new one

Fixed

  • Link opens a page with a Sign in button
  • Scanner loads the page but cannot press the button
  • User signs in once
  • 'Send a new link' is offered if it fails

How to confirm it's fixed

Fix verification
  • A request produces an email in under a minute in Gmail, Outlook and a work inbox.
  • The email is in the inbox, not spam.
  • The link signs the user in once and lands on the right page.
  • A second click gives a clear message and a way to request a new link.
  • The code works with spaces or lower-case letters, and a new code can be requested.
  • The provider log shows delivered for each test.

How to prevent it happening again

How an unnoticed break unfolds
  1. Example: Day 0

    A DNS change or provider key rotation stops sign-in emails.

  2. Example: Day 1

    Users cannot log in. Support tickets are few because most just leave.

  3. Example: Day 5

    Someone on the team notices fewer active users.

  4. Example: Day 6

    Cause found and fixed.

Habits that prevent it
  • Re-test sign-in after any change to DNS, email provider, auth library or domain.
  • Alert on bounce and failure rates in your email provider.
  • Keep SPF, DKIM and DMARC valid and review them after domain changes.
  • Offer a second sign-in method, such as a code alongside a link, so one failure is not a dead end.
  • Run an automated login check on a schedule instead of waiting for complaints.

How FunnelGuard handles this

FunnelGuard detects this today. For a login step that uses an emailed link or code, the robot visitor requests the sign-in and checks that the email reaches the test login's own FunnelGuard inbox. If it does not arrive, the check fails.

A failure is re-checked from a second region before one alert goes out by email, Slack, Teams, WhatsApp, webhook or PagerDuty, with a screenshot and a likely cause. Test traffic is marked with utm_source=funnelguard, fg_test=1, an fg_test cookie and its own user agent. FunnelGuard never bypasses CAPTCHAs or bot protection, so a login behind one needs a test setup that allows it.

The Free plan covers 1 site and 2 journeys with daily checks and no card. Paid plans start at $39/month with a 3-day free trial.

Questions people ask

Why is my magic link email not arriving?

Usually the email was never sent, was bounced or suppressed by your provider, or was filtered as spam. Check your email provider's logs for the message status first, then confirm SPF, DKIM and DMARC are set for the sending domain.

Why does my magic link say it has expired when I just clicked it?

A common cause is a mail security scanner that opened the link before you did and used up the single-use token. Another is a very short lifetime or mismatched server clocks. Open a confirm page with a button instead of signing in on page load.

Why is my sign-in code rejected?

The code may have been replaced by a newer one, typed with spaces or the wrong case, or the attempt limit may have been reached. Trim spaces, ignore letter case, allow a few attempts and offer a Send a new code button.

How long should a magic link last?

Many products use 15 to 60 minutes. Choose a lifetime long enough for slow email delivery but short enough for your risk level, and state it in the email.

How do I stop email scanners from using up my magic links?

Make the link open a page with a Sign in button that sends a POST request, and only consume the token on that request. Scanners usually fetch the URL but do not press buttons.

Why does my magic link only work in the same browser?

Some systems tie the token to the browser session that requested it. If people open email on their phone, the link fails. Remove that requirement or show a clear message with a code as a fallback.

How can I monitor passwordless login automatically?

Use a synthetic check that requests the sign-in on a schedule and confirms the email arrives in a test inbox. FunnelGuard does this for login steps with an emailed link or code and sends one alert if the email does not arrive.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

How: login step with an emailed link / code method: the test login's own FunnelGuard inbox receives it (Stage 20).

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.