skip to Main Content

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>

2

Answers


  1. Chosen as BEST ANSWER

    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.


  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search