Globe
Globe

Reputation: 305

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>

Upvotes: 2

Views: 1415

Answers (2)

Globe
Globe

Reputation: 305

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.

Upvotes: 2

Remoo
Remoo

Reputation: 747

Did you add the scheme you used in the info.plist file? which is needed for the os to know to open URL with that scheme in this app. Which is as follows:

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>YourSchemeHere</string>
        </array>
    </dict>
</array>

and this is the official doc about that

Upvotes: 1

Related Questions