Do not start by blaming email delivery: this week, inspect the confirmation link, compare the signup request’s emailRedirectTo with the project’s allowed Redirect URLs, and check the email template before testing account confirmation and the final landing page. This applies when a message arrives but opens localhost or another unintended environment.
This guide is for developers building email signup confirmation with Supabase Auth.
It is also for QA engineers collecting evidence for preview releases.
Independent developers maintaining local, preview, and production settings can use it to check that those environments do not cross.
Start with the destination visible in the email
Before opening a confirmation link, record its destination host and path. Do not copy or share the full URL: it can contain a token or other sensitive authentication data. The host gives an early clue about where the problem sits.
A message arriving only proves that the message reached an inbox. It does not prove that the link points to the intended environment, that Supabase Auth completes confirmation, or that the app handles the return correctly. Treat those as separate checks.
Follow this route through the flow:
- Email link: What destination is embedded in the message?
- Verification endpoint: Does the link reach the expected Supabase Auth verification flow?
- Application callback: Does the app receive and process the return?
- Final landing page and account state: Does the user end up in the intended place, with the account confirmed?
The Supabase Auth Redirect URLs documentation explains how allowed redirect destinations are configured. Use it to check the project’s actual rules rather than assuming that a destination supplied by application code is automatically accepted.
| Observed symptom | First place to inspect | Diagnostic value |
|---|---|---|
The email link itself names localhost |
Signup request, Site URL, and template | High: the wrong destination is already present before the click |
The link names the intended host, but the browser lands on localhost |
Verification return and application routing | High: investigate what happens after the initial link opens |
| The app opens, but the account remains unconfirmed | Verification result handling and account state | High: a page load alone does not establish successful confirmation |
| The message is missing | Delivery and test inbox checks | Low for a redirect diagnosis: no link is available to inspect yet |
This separation prevents a common false pass: a tester sees the email arrive, clicks it, sees a page load, and marks the flow successful without checking the destination or account state.
Step one: compare the request with the project default
Supabase Auth uses the project’s Site URL as the default destination when a request does not specify a redirect. A signup request can supply a request-specific destination through emailRedirectTo. The official Redirect URLs guide describes the default and the allowed destination rules.
For a JavaScript signup request, the option is passed inside options:
const { data, error } = await supabase.auth.signUp({
email,
password,
options: {
emailRedirectTo: "https://preview.example.test/auth/callback"
}
});
The example uses a placeholder host. Replace it with the real address for the environment under test. Do not put a local development address into a shared production configuration simply because it worked during local development.
Compare the request against the configuration that is active in the same Supabase project:
| Setting or evidence | What it controls | What to compare | Rating |
|---|---|---|---|
| Site URL | Default redirect when the request does not provide a destination | Is it the intended default for this project? | High for requests without an explicit destination |
emailRedirectTo |
Destination requested for a specific auth operation | Does its scheme, host, and path match the test environment? | High for request-specific diagnosis |
| Redirect URLs | Destinations the project allows | Does the exact request destination satisfy an allowed entry? | High when an explicit destination is ignored or rejected |
| Rendered email link | The destination actually sent to the inbox | Does the link match the intended request and project settings? | Highest: it shows the result the user will open |
| App callback and landing route | What the application does after verification | Does the callback finish processing and route to the expected page? | High when the link starts correctly but the final page is wrong |
The table is a diagnostic comparison, not a substitute for checking the message. Configuration can look consistent in an editor while the rendered link shows a different outcome. The request, project settings, and actual link are the evidence to compare.
If the request does not include emailRedirectTo, first check whether the Site URL is intentionally the correct default. If the request does include it, do not assume that the default is still the destination in use. Inspect the resulting message link to see what Supabase Auth generated.
Step two: confirm that the requested destination is allowed
Passing a destination in code and allowing that destination in the project are separate parts of the configuration. A request can ask to return to a preview host, while the project’s Redirect URLs list does not permit that host or path. That mismatch can lead to a fallback or an unexpected result, depending on the request and configuration. Confirm the behavior in the project rather than treating any one failure mode as universal.
Check the relevant entry in the project’s Redirect URLs settings against the exact emailRedirectTo value:
- Compare the scheme, such as
https, as well as the host. - Compare the path, especially when the callback lives below the root route.
- Review wildcard entries against the official matching rules. Do not assume a wildcard covers every path or every subdomain.
- Confirm that the address belongs to the environment being tested, not a stale local or preview setup.
- After changing the configuration, create a fresh signup test and inspect its newly generated email link.
A broad allow rule may be convenient, but it is not automatically the best release setting. Keep the entries limited to destinations the application actually uses, and make their purpose clear to the team. That makes accidental environment crossover easier to spot during review.
Step three: inspect the rendered template, not just its editor
When the email link does not match the request and project configuration, inspect the confirmation template. A fixed host in the template can override the intended destination in the link the user receives. So can a variable that does not correspond to the auth flow being tested.
The Supabase Auth email template documentation describes available template variables and their usage. Check the relevant template against that guidance. In particular, determine whether the message uses a confirmation URL or a redirect-related variable appropriate to the flow, and whether any destination has been hard-coded.
Do not infer the final destination from the visible wording in the template editor. The message may contain a link whose generated URL differs from the label text. Send a controlled test and inspect the actual link target in the received message. Record its host and path, but redact token values before storing or sharing the evidence.
This is also where a template can make an otherwise sound configuration look broken. If the message uses a fixed link, changing emailRedirectTo may not produce the expected result in the delivered message. Fix the template and repeat the signup test rather than compensating with a different callback route.
Step four: separate verification from the app’s return handling
A confirmation flow can reach the expected host and still fail. The verification endpoint, the application callback, and the final landing page are distinct parts of the journey. A page opening proves neither that verification completed nor that the app processed the result.
Check the flow in order:
- Verification endpoint: Confirm that the link is intended for the signup confirmation flow and reaches the expected Supabase Auth endpoint.
- Application callback: Confirm that the callback route exists in the tested build and handles the result returned by the auth flow.
- Final landing page: Confirm that routing does not replace the intended destination with a default route, an old local URL, or a stale environment variable.
- Account state: Verify the account’s confirmation status through the application’s supported test procedure. Do not use visual page load as a substitute for checking state.
- Error feedback: If the return URL contains an error, parse and display it according to the documented flow instead of silently routing to a generic success page.
Supabase provides a verifyOtp reference with a TokenHash verification example. Use the verification method that matches the application’s email flow; do not copy a TokenHash example into a different flow without checking its assumptions. For errors, consult the Supabase Auth error codes and troubleshooting guide and handle the reported result rather than treating any redirect as success.
Avoid logging full callback URLs. Authentication results can include sensitive values. For QA evidence, capture the environment, the non-sensitive destination host and path, whether the callback completed, and the resulting account state. That is enough to localize the fault without spreading credentials.
Run a controlled environment regression
After fixing the suspected cause, test each environment independently. Use an address that the test team controls and a fresh signup attempt for each run. Do not test against unrelated third-party services or create accounts on platforms outside the team’s control.
For each run, record:
- Environment name: local, preview, or production.
- The configured Site URL and relevant allowed Redirect URLs entry.
- Whether the signup request supplied
emailRedirectTo, and the non-sensitive destination host and path. - The destination host and path found in the delivered email link.
- Whether the verification callback completed.
- The observed account confirmation state and final landing page.
Then compare the evidence across environments. A local test that succeeds does not establish that preview or production uses the same project settings, template, build variables, or callback route. Keep separate test records so a passing result in one environment cannot conceal a mismatch in another.
For a test plan, define clear pass conditions: the email link must target the intended environment; the callback must process the confirmation result; the account must reach the expected confirmed state; and the app must land on the intended page. If any condition fails, note the first point where observed behavior diverges from the expected route.
If the message does not arrive at all, switch to a delivery investigation rather than continuing to diagnose a link that cannot be inspected. The email delivery troubleshooting guide covers a separate set of checks for that case. Keep delivery evidence and redirect evidence distinct in release notes.
Keep test inboxes separate from work accounts
A dedicated test address helps keep signup and confirmation traffic out of a developer’s primary inbox. It also makes it easier to find the exact message generated for a controlled run. The inbox choice does not fix a wrong redirect, however; the link and project settings still need to be checked.
For repeated testing, decide whether the test address needs to remain available between runs. A disposable inbox suits short-lived checks, while a persistent address or alias may fit a workflow that needs later access to the same account. The mailbox lifetime guide can help frame that choice. Avoid putting real customer details into test accounts, and avoid treating a temporary test address as the recovery address for an important account.
When choosing a test inbox, consider the workflow rather than just whether it can receive one message. Can the tester find the latest confirmation email? Is the address appropriate for the environment? Is continued access needed for password reset or later regression? These questions determine whether a temporary inbox is adequate or whether a longer-lived test mailbox is safer.
For a sign-up and redirect check on a product owned by the team, a temporary address can isolate test traffic from a work inbox. It cannot guarantee delivery or prove that Supabase Auth accepted the redirect. Those results still come from the actual email link, the project configuration, and the account state.
FAQ
Why can a confirmation email arrive but still open localhost?
Email receipt and redirect behavior are separate outcomes. A message can arrive correctly while containing a link generated from an unintended default, a request parameter, or a hard-coded template destination. Record the destination host before opening the link. Then compare it with the request and the project’s allowed Redirect URLs.
What should be checked when emailRedirectTo appears to be ignored?
Compare the exact value sent by the signup request with the project’s allowed Redirect URLs and inspect the message actually delivered. Check for differences in scheme, host, or path, and review the email template for a fixed destination. The generated link is stronger evidence than the request code alone.
How can a tester prove that the template uses the expected destination?
Send a controlled message through the same signup flow and inspect its actual link target. Compare the non-sensitive host and path with the expected environment, request parameter, and project configuration. Do not rely only on template editor text, and redact tokens before saving or sharing the result.
Does a correct landing page prove that signup confirmation succeeded?
No. A route can load even if the confirmation result was not processed or the account did not reach the expected state. Check callback handling and account confirmation separately. If the return URL carries an error, follow Supabase’s documented error handling rather than marking the test successful based only on the page displayed.
For a controlled test of a product owned by the team, QuickMX can provide a temporary inbox without requiring a separate registration: the test address can be used immediately, keeps the primary work address private, and keeps test messages out of the main inbox. Use it to inspect the actual confirmation link, then verify the destination and account state against the Supabase Auth settings.
Frequently asked questions
Why does a Supabase Auth confirmation email open localhost?
Start with the destination embedded in the actual email link. If it already names localhost, compare the signup request's emailRedirectTo value with the project's Site URL and allowed Redirect URLs. Then inspect the email template for a fixed destination or an incorrect variable. If the link names the expected host but the browser ends up elsewhere, trace the verification callback and the app's own routing separately.
How is emailRedirectTo different from the Supabase Site URL?
The Site URL acts as the default redirect destination when a request does not specify one. emailRedirectTo is a destination supplied for a particular authentication request, such as signup. A supplied destination still needs to satisfy the project's Redirect URLs policy. The project configuration, request options, and generated email link should all agree with the environment being tested.
How should a confirmation destination be added to Redirect URLs?
Add the actual destination used by the app to the project's allowed Redirect URLs, following Supabase's documented path and wildcard rules. Compare the configured entry with the full emailRedirectTo value, including scheme, host, and path. Do not assume that a URL passed by the client is allowed automatically; verify the resulting link from a test message.
How can the expected redirect in an email template be verified?
Inspect the rendered message's actual link rather than relying on the template editor preview. Check whether the template uses a confirmation link or redirect variable appropriate to the flow, and look for hard-coded hosts. In a controlled signup test, record the link's destination host and path without sharing its token, then compare them with the request and project settings.
Choose the right entry point for your next email relationship
Get mail immediately for one-off tasks, while keeping control of long-term relationships. QuickMX provides both entry points, each designed for a different commitment.