FBSDKAuthenticationToken.current
returns the actual valid authentication token only after a certain delay
#2417
Labels
Checklist before submitting a bug report
Xcode version
15.2
Facebook iOS SDK version
17.0.1
Dependency Manager
Prebuilt Binaries
SDK Framework
Login
Goals
I want to use
FBSDKAuthenticationToken.currentAuthenticationToken
when the user opens the application, this user has logged-in with the limited log-in in a previous session and I'd like to use his authentication token.Expected results
To get a non-nil
FBSDKAuthenticationToken.currentAuthenticationToken
whenever it is called, it happens after the set-up of the facebook-ios-sdk, the facebook-ios-sdk should be useable at that time.Actual results
In reality
FBSDKAuthenticationToken.currentAuthenticationToken
isnil
when I first access it, I get the non-nil valid value only with a retry mechanism. With solid internet connection I get the non-nil auth token only after 0.4 seconds after the first call to the the method approximately.The main issue is I don't know when the user is actually logged-out and when the authentication token in
nil
because of this delay, if the user logs-out via facebook's side I'll just run my retry mechanism until I reach time out.It is worth noting that the exact same issue occurs with
FBSDKAccessToken.currentAccessToken
in the non-limited regular log-in. When I used version 12.3.1 of the sdk I got the valid non-nil value as soon as I accessed it, now I get the same delay there.The
currentAuthenticationToken
isn't well documented, it isn't clear when it should benil
or not, it feels like there was a behavior change under the hood.Bottom line, please explain when and why the authentication token is
nil
, when should I decide that the user is actually logged-out and when I need to wait/retry, an even better solution is to ensure that theFBSDKAuthenticationToken.currentAuthenticationToken
andFBSDKAccessToken.currentAccessToken
are accessible as soon as possible whenever they have a value, otherwise doc them to explain how they should be used.Thanks!
Steps to reproduce
FBSDKAuthenticationToken.currentAuthenticationToken
isnil
even though the user should be logged-in.Code samples & details
The text was updated successfully, but these errors were encountered: