facebook / facebook/facebook-ios-sdk
`AccessToken.current` is always null, even after successful login
- Dominant language
- Swift
- Stars
- 8.1k
- Forks
- 3.7k
- PR merge metrics
- No merged PRs in 30d
Description
### Checklist before submitting a bug report
- [X] I've updated to the latest released version of the SDK
- [X] I've searched for existing [GitHub issues](https://github.com/facebook/facebook-ios-sdk/issues)
- [X] I've looked for existing answers on [Stack Overflow](https://facebook.stackoverflow.com), the [Facebook Developer Community Forum](https://developers.facebook.com/community/) and the [Facebook Developers Group](https://www.facebook.com/groups/fbdevelopers)
- [X] I've read the [Code of Conduct](https://github.com/facebook/facebook-ios-sdk/blob/main/CODE_OF_CONDUCT.md)
- [X] This issue is not security related and can safely be disclosed publicly on GitHub
### Xcode version
14.3.1 (14E300c)
### Facebook iOS SDK version
16.1.3
### Dependency Manager
Building from Source
### SDK Framework
Login
### Goals
We noticed in our live games that FB sessions were just disappearing. The normal login flow would occur but then after closing the game and re-launching the access token would be null. This issue didn't affect all users but we had tens of thousands of logs showing it occurring.
Using the SDK in the most basic sense, we would simply login. After successful login we grab the profile data. After the app is closed and we re-launch the token would be wiped and our users would be logged out of FB.
### Expected results
The expected result would be for the AccessToken to persist across launches.
### Actual results
The actual results are the AccessToken is null. Note that using the repro steps below this can be seen that _without even requiring a shutdown + relaunch_ the AccessToken can still be null.
### Steps to reproduce
Using the `FacebookLoginSample` the issue can be reproduced.
- download latest source from Github
- add proper bundle ID and replace placeholder with a real FB app ID
- run on a device and login (either Login Button Example or Login Manager Example will repro)
- notice in the Current Login Details page that after logging in `AccessToken.current` is null but all other data is present (token string, profile, etc). See attached image.
### Code samples & details
```swift
The unmodified FacebookLoginSample will reproduce the issue (after adding proper FB App ID + bundle ID + URL Scheme)
```
Contributor guide
Assessment
This issue has not been assessed yet.