-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
16.0.1 FB SDK doesn't keep user logged in on subsequent sessions #695
Comments
Only a problem with iOS as far as I can tell. The breaking commit was 7ba25ae |
bump, we're also suffering the same problem |
Same issue on iOS |
bump, we're experiencing same issue after update( |
Summary: Bug reported in GitHub: #695 "FB SDK doesn't keep user logged in on subsequent sessions". It's only happening in the last release of the SDK and on iOS according to user and partner reports. This diff fixes this issue. According to the instructions in the iOS SDK (https://github.com/facebook/facebook-ios-sdk/blob/41044df838ef3fefe600fb96b6560dc8a2b2a18a/FBSDKCoreKit/FBSDKCoreKit/ApplicationDelegate.swift#L55-L56), "Do not use the method initializeSDK if you are using the SDK within the context of the 'UIApplication' lifecycle", which is the case of the Unity SDK, "Instead use 'application(_:didFinishLaunchingWithOptions:)'" Basically, the didFinishLaunchingWithOptions method is called after state restoration has occurred (for example, when the app is launched again after it is suspended or in the background). It is needed to restore the user information, such as the access token. Reviewed By: GMc14 Differential Revision: D48560401 fbshipit-source-id: 6a6269ad8392db164638e24b04a666c71bfe5c7f
You need to wait for the main thread after initializing the "FB.Init" Facebook sdk but if error still occur try refreshing current access token after confirming if user logged in |
Same issue on iOS for Unity FB SDK 16.0.2 |
This is the right answer.
|
After the fixed in Unity FB SDK 17.0.1 Finally, I found the reason is that didFinishLaunching in FBUnityInterface.mm called after the FB.Init (Called on awake) on my code, it's caused the AccessToken.CurrentAccessToken keeps null all the runtime if not call FB.Mobile.RefreshCurrentAccessToken to get AccessToken. This is the order of execution:
I think the right call order should be 1 -> 3 -> 2 why could not FB initializeSDK in IOSFBInit funtion? |
Hi,
I've already opened it on a previous channel but was wrongly dismissed
https://developers.facebook.com/support/bugs/297755336112477/
So, I will give all info here.
Checklist
Environment
Unity Editor Version: 2021.3.25f1
Unity FB SDK 16.0.1
Builds: iOS and Android. Any version.
Goals
Use FB Login with a user-provided FB account so user will be logged in with FB in the game.
Expected Results
After the user logs in with Facebook login is not requested from the user until the token is expired, regardless of the game being closed.
Actual Results
The user logs in and has a valid non-expired access token with further away expiration in the future, when the game is closed and opened again FB SDK does not identify the user being logged in so it will ask the user for login again, no matter how many times it does never save it.
Steps to Reproduce
1 - Create Unity project and add FB SDK (16.0.1) to it (iOS/Android devices)
2 - Initialize Facebook SDK (
FB.Init
) and ask user to loginFB.LogInWithReadPermissions
use gaming_profile permission3 - With the user successfully logged in close and kill the game
4 - Reopen the game, and check that after initializing facebook it still needs login (FB.IsInitialized = true and FB.IsLoggedIn = false)
Code Samples & Details
The text was updated successfully, but these errors were encountered: