Search code examples
flutterauthenticationoauthdeep-linkingsupabase

Flutter and Supabase - OAuth deep link not working


I have set up OAuth with my Flutter app and Supabase. It works on the web... I sign in to the provider and I'm redirected to my website with the credential. However, in iOS, it does not work. I sign in to the provider and am still redirected to the website instead of the app. I added CFBundleURLSchemes to the Info.plist and associated domains, but that did not work. This is the function I use, which is what the Supabase example shows:

Supabase.auth.signInWithOAuth(
  pkg.Provider.apple,
  redirectTo: kIsWeb ? null : '<Bundle url>://login-callback/',
);
    <key>CFBundleURLTypes</key>
    <array>
      <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLSchemes</key>
        <array>
          <string>*bundle id*</string>
          <string>domain.com</string>
        </array>
      </dict>
    </array>

Solution

  • I found the issue. In a separate guide for Supabase, it mentions needing to add '<Bundle url>://login-callback/' as a redirect_url on the server itself. With self-hosting, this shows up as ADDITIONAL_REDIRECTURLS in .env.