firebase / FirebaseUI-Flutter

Apache License 2.0
107 stars 100 forks source link

🐛 [firebase_ui_auth] Sign in with Apple shows on unsupported iOS versions #49

Closed lukasnevosad closed 1 year ago

lukasnevosad commented 1 year ago

Bug report

Sign in with Apple should not be available on iOS prior to version 13.0, as it is not supported.

Steps to reproduce

Steps to reproduce the behavior:

  1. Run SignInScreen() with AppleProvider() on older iOS (tested on 12.5.2)
  2. Tap Sign in with Apple
  3. Log shows "Sign in with Apple was introduced in iOS 13, update your Podfile with platform :ios, '13.0'"
  4. Spinner spins endlessly, App will not sign in

Expected behavior

Sign in with Apple does not show as an option -OR- state handled and error shown


Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand ``` Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.3.9, on macOS 13.0.1 22A400 darwin-arm, locale en-CZ) [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 14.1) [✓] Chrome - develop for the web [✓] Android Studio (version 2021.1) [✓] VS Code (version 1.73.1) [✓] Connected device (9 available) [✓] HTTP Host Availability ```

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand ``` firebase_core: ^2.3.0 cloud_firestore: ^4.1.0 firebase_storage: ^11.0.6 firebase_auth: ^4.1.5 firebase_dynamic_links: ^5.0.6 firebase_crashlytics: ^3.0.6 cloud_functions: ^4.0.5 firebase_app_check: ^0.1.1+5 firebase_ui_auth: ^1.1.0 firebase_ui_oauth_apple: ^1.0.7 firebase_ui_oauth_facebook: ^1.0.7 firebase_ui_oauth_google: ^1.0.7 ```

darshankawar commented 1 year ago

Thanks for the report. I don't have an older device to verify this, but keeping it open for team's attention.

/cc @Lyokone

Lyokone commented 1 year ago

@lesnitsky I think we should maybe add a condition before showing Sign In With Apple on devices before iOS 13?

lesnitsky commented 1 year ago

as discussed with @kroikie, performing a platform check silently inside the library is not an ideal solution: imagine the app that only uses Apple Sign in. It will have Apple Sign in button on iOS > 13, but devices running iOS earlier than 13 would have no auth providers at all. I'm not sure what would be the best solution for this.

As a workaround, developers can make platform check on their own using device_info_plus plugin and decide whether to include Apple Sign in as a provider.

lukasnevosad commented 1 year ago

Thank you for looking into this! You guys do an awesome job!

My two bits is that as a developer I would be perfectly OK with firebase_ui_auth doing a silent check and just not showing the button in this particular case. It would also be consistent with how other providers behave on unsupported platforms.

Also I think that a developer relying solely on Sign in with Apple should not target iOS 12 or earlier anyway...

mrclauss commented 1 year ago

I just stumbled across this issue/topic. I'm not using the firebase ui but ran into what @lesnitsky mentioned, I have the same UI on all platforms (and would like to keep it agnostic), triggering authentication with AppleAuthProvider does not return an error or exception or anything on ios<13, so I cannot even handle this in any way in the flutter code. So I would really appreciate an exception from AppleAuthProvider (just like for all other errors).

mrclauss commented 1 year ago

To be precise: channel.invokeMapMethod in method_channel_firebase_auth.dart, line 590 never ever returns, so I guess this should have a fix in the native implementation. (firebase_auth_platform_interface-6.11.11 that was).

rubenaster commented 1 year ago

I just stumbled across this issue/topic. I'm not using the firebase ui but ran into what @lesnitsky mentioned, I have the same UI on all platforms (and would like to keep it agnostic), triggering authentication with AppleAuthProvider does not return an error or exception or anything on ios<13, so I cannot even handle this in any way in the flutter code. So I would really appreciate an exception from AppleAuthProvider (just like for all other errors).

Yep, same here!

lesnitsky commented 1 year ago

@Lyokone might need your involvement for the native side of things.

For the UI side, the recommendation is to use device_info_plus and query the platform version before configuring FirebaseUIAuth.