Supabase emailRedirectTo ignored: redirect_to always falls back to Site URL despite being in allow-list (Capacitor + Android App Links)


Problem
I am building a Capacitor app (Android) and using Supabase for authentication. I need the email confirmation link to open my native app, not my website.

I have set up Android App Links (assetlinks.json, intent-filter, etc.) and added my redirect URLs to the Supabase allow-list. However, when Supabase sends the confirmation email, the redirect_to parameter is always overridden and points to my bare Site URL (https://farmearn.co.zw), causing the link to open the website in a browser instead of the app.

What I've tried

  1. Confirmed both https://farmearn.co.zw/auth/callback and zw.co.farmearn.app://auth/callback are in Authentication → URL Configuration → Redirect URLs.

  2. Confirmed the emailRedirectTo is correctly passed in the client code.

  3. Changed the email template to use {{ .RedirectTo }} and manually build the URL to avoid the known Supabase bug that strips paths from {{ .ConfirmationURL }}.

  4. Disabled Custom SMTP (Resend) to rule out an email provider stripping the parameter.

Despite all this, the generated link looks like this (notice redirect_to has no /auth/callback path):
https://mwkfusrofzxarvsggfmx.supabase.co/auth/v1/verify?token=...&type=signup&redirect_to=https%3a%2f%2ffarmearn.co.zw

Relevant Code & Configuration

1. Client Code (src/services/authService.ts)

const result = await CapacitorSupabase.signUp({
  email: payload.email.trim(),
  password: payload.password,
  options: {
    data: {
      full_name: payload.fullName.trim(),
      role: payload.role,
    },
    emailRedirectTo: Capacitor.isNativePlatform() 
      ? 'https://farmearn.co.zw/auth/callback' 
      : undefined,
  },
});

2. Android Manifest (android/app/src/main/AndroidManifest.xml)

<intent-filter android:autoVerify="true">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="https" android:host="farmearn.co.zw" android:pathPrefix="/auth/callback" />
</intent-filter>

3. Email Template (Supabase Dashboard → Auth → Emails → Confirm signup)

<h2>Confirm your signup</h2>
<p>Follow this link to confirm your user:</p>
<p>
  <a href="{{ .SiteURL }}/auth/v1/verify?token={{ .TokenHash }}&type=signup&redirect_to={{ .RedirectTo }}">
    Confirm your mail
  </a>
</p>

Then the urls l get on the email are : https://farmearn.co.zw/auth/v1/verify?token=7403e62b4a8d67ecf900c3a5640849f6f2d4d801641c1b1fb06262b6&type=signup&redirect_to=https%3a%2f%2ffarmearn.co.zw, https://mwkfusrofzxarvsggfmx.supabase.co/auth/v1/verify?token=9cddb7b91bc1c862a5c3414c29dbbef6baec322d475896feffbee388&type=signup&redirect_to=https%3a%2f%2ffarmearn.co.zw, https://farmearn.co.zw/auth/v1/verify?token=4f8d2e7df11781dfca2814c87ae456363527486f2cb5c910cbe11ffd&type=signup&redirect_to=https%3a%2f%2ffarmearn.co.zw

Why is Supabase completely ignoring the emailRedirectTo parameter and the allow-list, and falling back to the Site URL? Is this a known bug, and is there a specific workaround required for Capacitor/Android deep links?

enter image description hereenter image description here

0
Nov 20 at 10:32 AM
User AvatarBrandon
#android#authentication#deep-linking#capacitor#supabase

No answer found for this question yet.