Facebook-sdk-for-unity: Login gets stuck in loop in 9.0.0 if Facebook app is installed

Created on 2 Feb 2021  ·  6Comments  ·  Source: facebook/facebook-sdk-for-unity

Checklist

Environment

Describe your dev environment here, giving as many details as possible. If you have them, make sure to include:

  • Unity Editor Version: 2018.4.23
  • Unity SDK Version: 9.0.0
  • Installation Platform & Version: [iOS] version 12.1.2, 12.4.1, 11.4.1

Goals

I want to do Facebook login in the the application.

Expected Results

Facebook login to complete successfully.

Actual Results

After pressing the Facebook login button in the application, it gets forwarded to WebView with a button to 'Log in with the Facebook App', it also automatically asks to "Open this page in 'Facebook'"? Facebook app then says "you're already logged in.. Would you like to continue?" with a 'continue' button. Once the 'Continue' button is pressed, it returns to WebView with 'Log in with the Facebook app' which again takes you to app and then to webview and then to app...

Steps to Reproduce

  • Have iOS12 device & FB Unity SDK 9.0.0
  • Have Facebook app installed on the device
  • Try to login to Facebook from an app using Facebook Login.
  • This then leads to the loop mentioned above.

We've reproed this on both iOS12 and iOS11. iOS14 seems to be only using webview, and not forwarding to app. iOS13 we have not tested.

Bug is also tracked by Facebook at https://developers.facebook.com/support/bugs/436228210835738/

bug

All 6 comments

Hi @SeriouslySam, thank you for reporting this issue! Could you please provide the app name?

App is Best Fiends (https://apps.apple.com/us/app/best-fiends-puzzle-adventure/id868013618)

I had a similar issue when I import AppsFlyer SDK into my project.

I follow the steps below to fix it.
https://github.com/AppsFlyerSDK/appsflyer-unity-plugin/blob/master/docs/iOS-Swizzling-Guide.md

Related post on stackoverflow: https://stackoverflow.com/questions/35100809/unity-facebook-sdk-ios-9-2-not-returning-to-app

@SeriouslySam Can you confirm that the same code works for previous SDK versions? If not you can try to check if you have any conflicting libraries as @ming060 suggested.

Thank you @ming060 , Appsflyer Swizzling was indeed the issue for us. After I turned that on, the login works again normally.

Thank you @ming060 , Appsflyer Swizzling was indeed the issue for us. After I turned that on, the login works again normally.

I had a similar issue, but I'm not using AppsFlyer.
My situation :
Unity Editor Version: 2019.2.21f
Unity SDK Version: 9.0.0
when click FB login button in game , if user has login in WebView , it has a 'continue' button in WebView. Once the 'Continue' button is pressed user will jump back to game but FB.IsLoggedIn is false in FB login callback at this time。Login gets stuck in loop if user not login in WebView。
i use FB.LogInWithReadPermissions to login, not limit mode.
All works well for previous SDK versions ( 8.1.1) .
help please

Was this page helpful?
0 / 5 - 0 ratings