Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Verification link lands on a login loop: how to find and fix it

CNV-286High impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

After signup, most SaaS products send an email with a verification link. The link should confirm the address and move the person into onboarding. In a login loop, the link opens, then your site redirects to the login page. The user logs in, is told to verify, and is sent a new link. Or they log in and land on the login page again.

The account may even be verified in your database. The problem is the hand-off between the link, the session and the page the user lands on.

Where the loop breaks
  1. Signup formAccount created
  2. Verification emailLink delivered
  3. Click the linkRedirected to /login
  4. OnboardingNever reached
  5. ActivationNever happens

The user does everything right, but the verify step ends on the login page.

Why it costs you leads or sales

These users already gave you their details and opened your email. They were close to activating. A loop at this point looks like a broken product, so many will leave and not return. You also pay for the signup: the ad click, the form and the email are all spent for nothing.

It is easy to miss. Signups still show in your analytics and your database, so the numbers look fine until you compare signups to activations.

Signups vs activated usersExample numbers
Signups vs activated users (example)Signups: 100 users; Clicked verify link: 70 users; Activated (loop present): 20 users; Activated (fixed): 62 users03877100702062SignupsClicked verify linkActivated (loop prese…Activated (fixed)users

Example: 100 signups in a week. A loop at the verify step cuts activation sharply while signups look healthy.

How to check if your site has it

Test it as a brand-new user. Do not use an account you are already logged in with, because an existing session hides the problem.

Manual test
  1. Open a clean browser session

    Use a private window with no cookies, or a different browser.

  2. Sign up with a new email address

    Use an inbox you can read, such as a plus address (name+test1@yourdomain.com).

  3. Click the link in the email

    Watch where you land. Note the final URL and whether you are logged in.

  4. Repeat on mobile and in another mail app

    Links opened from a mail app often open in a different browser or an in-app view with no cookies from your signup.

  5. Check the network tab

    In browser developer tools, open Network and keep Preserve log on. Look for a 301 or 302 that sends the verify URL to /login, and check if the token is still in the URL.

What the user sees

The link opens, then the user ends up on the login page instead of onboarding.

How to fix it

First find which of the common causes applies. The table below maps what you see to the likely cause.

Symptoms and likely causes
What you seeLikely causeFix
Verify URL redirects to /login with no tokenRoute is behind an auth guardAllow the verify route for logged-out users
Works in the same browser, fails from the mail appSession cookie not available in the new browserVerify by token alone, then create a session
Login works but you are sent back to loginCookie not saved (SameSite, Secure or domain mismatch)Fix cookie attributes and use one domain
Account shows verified but user is asked to verify againStale session or cache holds old verified flagRefresh the user record after verifying
Loop only after a www or http redirectRedirect changes host and drops the cookieUse one canonical https host in the link
Fix steps that apply to most apps
  1. Exempt the verify route from login checks

    The verify URL must work for a visitor with no session. Add it to your public routes or middleware allow list.

  2. Keep the token through redirects

    If the verify URL redirects (http to https, non-www to www, trailing slash), make sure the query string is kept. Better, put the canonical host in the emailed link.

  3. Mark the account verified before redirecting

    Save the verified flag first, then redirect. Do not send the user to a page that checks the flag before it is saved.

  4. Sign the user in or give a clear next step

    Either create a session on successful verification and go to onboarding, or go to login with a message such as 'Email confirmed. Log in to continue' and keep their intended destination.

  5. Check cookie settings

    Make sure the session cookie is set on the right domain, with Secure on https. SameSite=Lax is usually right for links from email; SameSite=Strict can drop the cookie on that first visit.

  6. Handle repeat clicks

    If the link is clicked twice, show 'Already verified' and continue to login or the app, not an error or a loop.

Platform notes
  1. Check the membership or login plugin

    Plugins such as membership, WooCommerce or login-redirect plugins can send unverified users to the login page. Look in their settings for email confirmation and redirect options.

  2. Exclude the verify URL from caching and redirects

    In your cache plugin, exclude the verification URL. In any redirect plugin, make sure rules do not strip the query string.

  3. Set the login redirect

    If your plugin has an option for where users go after confirming, point it to a page that does not require a login, or enable auto-login after verification.

Example: Express verify route that does not loopjavascript
// Public route: no auth middleware
app.get('/verify', async (req, res) => {
  const { token } = req.query;
  const user = await db.users.findByVerifyToken(token);

  if (!user) return res.redirect('/login?error=invalid_link');

  if (!user.verified) {
    await db.users.update(user.id, { verified: true, verifyToken: null });
  }

  // Create a session so the user is not sent to login
  req.session.userId = user.id;
  req.session.save(() => res.redirect('/onboarding'));
});
Verify link behaviour

Login loop

  • Link redirects to /login
  • Token is lost on the way
  • User is asked to verify again

Fixed

  • Verify route is public
  • Account is marked verified first
  • User lands in onboarding or sees a clear message
Try the causeInteractive
Verify route behind login guard

Guard on

Leads or data lost

The new user clicks the link, is sent to /login, and never reaches onboarding.

Toggle to see how one routing rule can stop activation.

How to confirm it's fixed

Confirmation checklist
  • Sign up with a new address in a private window and click the link: you reach onboarding or a clear confirmation page
  • Click the same link a second time: you see 'Already verified', not a loop
  • Open the link from a phone mail app: it still works
  • Open the link in a different browser from the one used to sign up: it still works
  • The final URL has no leftover redirect chain in the network tab
  • The account shows as verified in your admin or database

How to prevent it happening again

This bug usually returns after changes to login rules, redirects, caching, domains or cookie settings. It is rarely caught by unit tests because it needs a real email and a clean browser.

Prevention habits
  • Add an end-to-end test: signup, read email, click link, assert the landing page
  • Re-test after any change to auth middleware, redirects, CDN rules or cookie settings
  • Keep one canonical https host in all emailed links
  • Track the share of signups that reach activation, and watch for drops
  • Test from a clean browser, never from a logged-in one

How FunnelGuard handles this

FunnelGuard detects this issue today. A robot visitor runs your signup journey on a schedule, then follows the verification link from the email (an email_link step) and checks where it ends up (an assert step). If the page after the click is not the one you expect, for example the login page instead of onboarding, the check fails.

A failure is re-checked from a second region before one alert goes out, with a screenshot and a likely cause. Alerts can go to email, Slack, Teams, WhatsApp, webhook or PagerDuty. Test traffic is marked (utm_source=funnelguard, fg_test=1, an fg_test cookie and its own user agent), and FunnelGuard does not bypass CAPTCHAs or bot protection.

Questions people ask

Why does my email verification link redirect to the login page?

Most often the verify route sits behind a login check, so a visitor with no session is sent to /login before the token is read. A redirect that strips the query string, or a session cookie that is not saved, can cause the same result. Make the verify route public and check that the token survives every redirect.

Why am I stuck in a login loop after confirming my email?

The account may be verified, but the session is not being kept or the app still sees an old unverified state. Check the cookie domain, Secure and SameSite settings, and make sure the user record is refreshed after verification. Also check that redirects do not move the user between www and non-www or http and https.

How do I test an email verification flow properly?

Use a private browser window, sign up with a new address you can read, and click the link from the email. Repeat from a phone mail app and a different browser. Note the final URL and whether you are logged in or sent to the login page.

Should the verification link log the user in automatically?

It can, if the token is single-use and short-lived, and it removes a step where users drop off. If your security rules need a password first, send the user to login with a message that the email is confirmed and keep their destination.

Why does the verification link work on desktop but not from my phone?

Mail apps often open links in an in-app browser or a different browser with no cookies from your signup. If verification depends on an existing session, it fails there. Verify using the token alone, then create a session or show a clear next step.

Can caching or a CDN cause a verification login loop?

Yes. A cached redirect to the login page, or a rule that drops query strings, can break the token. Exclude the verification URL from caching and check redirect rules for a lost query string.

How can I be alerted if verification links break?

Run an automated test that signs up, follows the email link and checks the landing page on a schedule. FunnelGuard does this with an email_link step and an assert step, and sends one alert with a screenshot when it fails.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

How: email_link then assert.

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.