darwin-morocho / flutter-facebook-auth

A flutter plugin to add login with facebook in your flutter app
191 stars 124 forks source link

IOS stuck on getUserData if API respond with 400 error #380

Closed algu1984 closed 1 month ago

algu1984 commented 3 months ago

What version are you using?

6.0.3

What OS and version are you using to local deploy your application?

MacOS

What platforms are you seeing the problem on?

iOS

pubspec.yaml

flutter_facebook_auth: ^6.0.3

Describe the Bug

await facebookLogin.getUserData(); - never returns on IOS if API respond with 400

https://github.com/darwin-morocho/flutter-facebook-auth/blob/master/facebook_auth/ios/Classes/FacebookAuth.swift#L111 never called i case of http 400 status code

Expected Behavior

it should throw PlatformException as on Android

To Reproduce

any 400 error is not propagated to reproduce it one can breakpoint on acebookLogin.getUserData(); remove facebook authrorization run line

Relevant log output

No response

flutter doctor -v

[!] Flutter (Channel unknown, 3.10.5, on macOS 14.2 23C64 darwin-arm64, locale
    en-PL)
    ! Flutter version 3.10.5 on channel unknown at /Users/agmyryak/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an
      official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions
      at https://flutter.dev/docs/get-started/install.
    ! Unknown upstream repository.
      Reinstall Flutter by following instructions at
      https://flutter.dev/docs/get-started/install.
    • Framework revision 796c8ef792 (7 months ago), 2023-06-13 15:51:02 -0700
    • Engine revision 45f6e00911
    • Dart version 3.0.5
    • DevTools version 2.23.1
    • If those were intentional, you can disregard the above warnings; however
      it is recommended to use "git" directly to perform update checks and
      upgrades.

[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/agmyryak/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      17.0.7+0-17.0.7b1000.6-10550314)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for
      more details.

[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15C500b
    • CocoaPods version 1.14.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      17.0.7+0-17.0.7b1000.6-10550314)

[✓] VS Code (version 1.85.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available)
    • MI 8 Lite (mobile) • 9bd966e • android-arm64  • Android 10 (API 29)
    • macOS (desktop)    • macos   • darwin-arm64   • macOS 14.2 23C64
      darwin-arm64
    • Chrome (web)       • chrome  • web-javascript • Google Chrome
      120.0.6099.216

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 2 categories.

Info.plist (iOS)

No response

Podfile (iOS)

No response

AndroidManifest.xml

No response

MainActivity.java

No response

MainActivity.kt

No response

index.html

No response

Info.plist (macOS)

No response

darwin-morocho commented 3 months ago

@algu1984 Sorry but I am not able to reproduce the issue. I have updated the native facebook sdk on iOS and Android maybe with this the issue was solved. Also keep in mind that you can get the user data using the graphApi and the http package to make a http API request

algu1984 commented 3 months ago

@darwin-morocho So you mean on IOS when you have 400 error from server getUserData throw PlatformException on Flutter right?

darwin-morocho commented 3 months ago

@darwin-morocho So you mean on IOS when you have 400 error from server getUserData throw PlatformException on Flutter right?

I didn't. I am not able to reproduce the 400 error

algu1984 commented 3 months ago

@darwin-morocho So you mean on IOS when you have 400 error from server getUserData throw PlatformException on Flutter right?

I didn't. I am not able to reproduce the 400 error

It's easy:

  1. breakpoint on getUserData
  2. remove token here image
  3. run line getUserData
darwin-morocho commented 3 months ago

@darwin-morocho So you mean on IOS when you have 400 error from server getUserData throw PlatformException on Flutter right?

I didn't. I am not able to reproduce the 400 error

It's easy:

  1. breakpoint on getUserData
  2. remove token here image
  3. run line getUserData

Sorry but I don't have any facebook account that throw an 400 error when I tried to get the user data. If you have experience in swift please feel free to open PR solving this. I think I will use the pure dart code to get the user profile and only use the facebook sdk fro login

algu1984 commented 3 months ago

@darwin-morocho So you mean on IOS when you have 400 error from server getUserData throw PlatformException on Flutter right?

I didn't. I am not able to reproduce the 400 error

It's easy:

  1. breakpoint on getUserData
  2. remove token here image
  3. run line getUserData

Sorry but I don't have any facebook account that throw an 400 error when I tried to get the user data. If you have experience in swift please feel free to open PR solving this. I think I will use the pure dart code to get the user profile and only use the facebook sdk fro login

You don't need any special account for this just before calling getUserData in Flutter you have to revoke authoritarian on Facebook page from screenshot (click Remove for your app) it will force FB to answer with error and getUserData never return

darwin-morocho commented 3 months ago

@darwin-morocho So you mean on IOS when you have 400 error from server getUserData throw PlatformException on Flutter right?

I didn't. I am not able to reproduce the 400 error

It's easy:

  1. breakpoint on getUserData

  2. remove token here

    image

  3. run line getUserData

Sorry but I don't have any facebook account that throw an 400 error when I tried to get the user data. If you have experience in swift please feel free to open PR solving this. I think I will use the pure dart code to get the user profile and only use the facebook sdk fro login

You don't need any special account for this just before calling getUserData in Flutter you have to revoke authoritarian on Facebook page from screenshot (click Remove for your app) it will force FB to answer with error and getUserData never return

I will be back with this the next week. Due to I don't have the time right now

iandis commented 3 months ago

This is an issue from the native iOS sdk See here

algu1984 commented 3 months ago

This is an issue from the native iOS sdk See here

Ok thanks waiting for FB fix than