Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Verification link expired or invalid token: how to fix it

DLV-192High impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

When someone signs up, your system creates a token: a long random string that proves the email address belongs to them. The token goes into a link in the verification email. When the link is opened, your site looks the token up and checks it is valid, unused and not past its expiry time.

Why it costs you leads or sales

The person has just given you their details and is at peak interest. If verification fails, they cannot log in, download the lead magnet or finish checkout. Many will not try again. You also lose the lead in your list if the account stays unverified, and support gets tickets that are hard to reproduce.

Where the signup journey breaks
  1. Signup formPerson submits email
  2. Verification emailArrives with link
  3. Click link'Expired' or 'invalid token'
  4. Account activeNever reached
  5. Download or purchaseNever reached

The token fails at the verification step, so everything after it is lost.

Common causes

Typical causes and how they show up
CauseWhat you seeFix direction
Email security scanner opens the link firstWorks for some, 'already used' for others, mostly business inboxesUse a confirm button (POST) or do not burn the token on GET
Expiry set too shortFails if the person opens the email after a few minutesExtend to 24 hours or more
Server clock or timezone mismatchExpires instantly, even when clicked at onceStore and compare expiry in UTC, sync server time
Token cut off or changed in the emailAlways invalid; link looks shorter or has odd charactersCheck link tracking, line wrapping and URL encoding
Newer email invalidated the old tokenPerson requested it twice and clicked the first emailResend the same valid token or say 'use the latest email'
Caching or redirect strips the query stringInvalid token on every clickExclude the verify URL from cache; keep the parameters on redirects
Multiple environmentsToken made on staging, checked on liveUse the correct site URL and shared token store

How to check if your site has it

Reproduce the failure
  1. Sign up with a fresh address

    Use a new inbox you control. Click the link within seconds, then try another signup and wait 30 minutes.

  2. Compare the link in the email with the one in your browser

    Copy the link from the email. Check the token is complete and that the address bar still shows it after any redirect.

  3. Test with a corporate or filtered mailbox

    If it fails only there, a link scanner is probably opening the link before the person does.

  4. Check server logs

    Look for two requests to the verify URL a few seconds apart, often from different IP addresses or a non-browser user agent. The first one consumed the token.

  5. Check created and expiry times

    In your database or user table, compare the token's creation and expiry timestamps. An expiry earlier than or equal to creation points to a clock or timezone bug.

The click that fails

The person clicks the link and lands on an error instead of a confirmed account.

How to fix it

Start with the cause you found. The steps below work on any setup, and the tabs cover platform specifics.

Fix the token handling
  1. Lengthen the expiry

    Set verification links to be valid for at least 24 hours. Short windows such as 10 minutes suit one-time login codes, not signup confirmation.

  2. Do not consume the token on a plain page load

    Make the link open a page with a 'Confirm my email' button that sends a POST request. Scanners follow links but rarely press buttons.

  3. Keep one valid token per user

    When a person asks for a new email, reuse the unexpired token or tell them to use the newest message. Do not silently invalidate a link they may still click.

  4. Use UTC everywhere

    Create and compare expiry times in UTC and keep server time synced (NTP).

  5. Protect the link from changes

    Turn off click tracking or link rewriting on verification emails, and exclude the verify URL from page caching and redirects that drop query parameters.

  6. Show a helpful error

    If the token really has expired, show a 'Send me a new link' button instead of a dead end. If it was already used, say the account may already be verified and link to login.

Platform specifics
  1. Check your membership or signup plugin

    Look in the plugin's email or registration settings for a link expiry option and raise it. Plugins differ, so check its documentation for the exact setting name.

  2. Exclude the verify page from caching

    In your caching plugin or host cache, add the verification URL or its query parameter to the never-cache list.

  3. Turn off link tracking in your SMTP or email plugin

    If your mail service rewrites links, disable click tracking for transactional emails.

Example: verify on POST, check expiry in UTC (Node/Express style)javascript
app.get('/verify', (req, res) => {
  // Show a button. Do NOT consume the token here.
  res.send(`<form method="post" action="/verify">
    <input type="hidden" name="token" value="${encodeURIComponent(req.query.token || '')}">
    <button>Confirm my email</button></form>`);
});

app.post('/verify', async (req, res) => {
  const token = decodeURIComponent(req.body.token || '').trim();
  const record = await db.findToken(token);
  if (!record) return res.status(400).send('Invalid link. Request a new one.');
  if (record.expiresAt <= new Date()) return res.status(400).send('Link expired. Request a new one.');
  await db.markVerified(record.userId);
  await db.deleteToken(token);
  res.redirect('/welcome');
});
Token handling before and after

Before

  • Token valid for 10 minutes
  • Link burns the token on first load, including scanner visits
  • Re-sent email invalidates the old link
  • Dead-end error page

After

  • Token valid for 24 hours or more
  • Confirm button sends the POST that uses the token
  • Latest unexpired token stays valid
  • Error page offers a new link
Signups that verifyExample numbers
Signups that verify (example)Before fix: 58 %; After fix: 91 %035705891Before fixAfter fix%

Example: illustrative numbers showing how many signups complete verification before and after the fix.

How to confirm it's fixed

Confirmation checks
  • Sign up with a new address and click the link immediately: the account is verified
  • Click the same link a second time: you see a clear 'already verified' message, not a raw error
  • Wait past your old expiry time, then click: it still works
  • Request two emails and click the older one: the behaviour matches your design
  • Test in a business mailbox that scans links
  • Check the link in the received email is not wrapped, shortened or truncated

How to prevent it happening again

Prevention
  • Retest the signup and verification journey after any plugin, theme, email provider or caching change
  • Keep token expiry and timezone settings in your deployment notes
  • Turn off link tracking on account and verification emails
  • Exclude verify URLs from caches and redirect rules
  • Test a fresh signup on a schedule instead of waiting for complaints

How FunnelGuard handles this

FunnelGuard detects this issue today. A robot visitor runs your signup journey on a schedule, submits a test lead, then follows the link in the email it receives (the email_link check). If the link lands on an error, an 'expired' message or an invalid token page, 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 (utm_source=funnelguard, fg_test=1, an fg_test cookie and its own user agent) so you can recognise it in your logs. FunnelGuard does not bypass CAPTCHAs or bot protection.

Questions people ask

Why does my verification link say expired right after I sign up?

Most often the token expiry is too short, the server clock or timezone is wrong so the expiry is already in the past, or an email scanner opened the link first and used it up. Check the token's created and expiry times in UTC and your server logs for an earlier request.

Why does my email verification link say invalid token?

The token the site receives does not match one it has stored. Common reasons are a link cut off or rewritten by email tracking, a redirect or cache dropping the query string, or a newer email replacing the older token.

Why does the verification link work for some people but not others?

Business inboxes often run security scanners that open every link before the person does. If your link uses the token on a simple page load, the scanner consumes it. Switch to a confirm button that sends a POST.

How long should an email verification link be valid?

For signup verification, 24 hours or more is a sensible choice. Shorter windows are better suited to login codes. Always give an easy way to request a new link when it does expire.

How do I stop email scanners from using up my verification link?

Do not mark the token as used when the link is opened with a GET request. Show a page with a 'Confirm my email' button and complete verification only when that button sends a POST.

Can email click tracking break a verification link?

Yes. If your email tool wraps or rewrites links, the token can be altered or the redirect can drop parameters. Turn off click tracking for verification and other account emails and test the received link.

How do I test that my verification link works?

Sign up with a fresh address, click the link at once, then try again after your old expiry time. Also test the same link twice and in a filtered business mailbox. FunnelGuard can run this journey on a schedule and follow the emailed link.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

How: email_link.

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.