I want accessToken in componentDidMount but getting null in the promise response when I restart (not reload) the app. I think that FBSDK login is not persisting the accessToken in the app. This only happens in iOS (Both: real device and simulator) and in Android, it works fine.
- Login into the app
- Calling AccessToken.getCurrentAccessToken() after login success (Note: I'm getting accessToken two times) after login (it works well) in the componentDidMount (I'm getting null even after login)
- After Login, I close & reopen (not reloading: in reloading the app, I'm getting the accessToken) the app (to invoke componentDidMount) but getting null in promise response.
Code:
const _checkFbAccessToken = async () => {
try {
const { accessToken } = await AccessToken.getCurrentAccessToken();
console.log(accessToken, ' ****accessToken');
} catch (error) {
// error in getting accessToken
}
};
Environment:
System:
OS: macOS 10.15.1
CPU: (8) x64 Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
Memory: 11.27 GB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 11.12.0 - /usr/local/bin/node
Yarn: 1.15.2 - /usr/local/bin/yarn
npm: 6.7.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 23, 25, 26, 27, 28
Build Tools: 28.0.2, 28.0.3
System Images: android-28 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5314842
Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.5 => 0.60.5
npmGlobalPackages:
react-native-cli: 2.0.1