You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use React native, Expo and some react-native-firebase library (more info bellow).
I'm facing a Firebase error (it seems) with token refresh and get currentUser.
Problem 1
For example, a user connects to my app, closes it after 5 minutes and reopens it the next day (the token has therefore expired, as its validity period is 1 hour).
In the back-end logs, I can see that some calls are made with a token that has been expired for several hours.
Given my code (that the token is checked before each call), I don't see how my api can receive calls with an expired token.
I also found that several other people potentially had similar concerns:
So I'm think that Firebase's token refresh function may have some problems.
Problem 2
Also, sometimes the currentUser is not retrieved with the function firebase.auth().currentUser; (returns null) even though I'm in the connected area.
This append on Android and iOS.
In my front, endpoint calls are handled simply:
1- Get accessToken from currentUser
2a- If the token is still valid -> it is returned
2b- If the token is no longer valid -> force its regeneration then return it
3- Call endpoint with the token (still valid or renewed) in Authorization header
Issue
Hi reader 👋
I use React native, Expo and some react-native-firebase library (more info bellow).
I'm facing a Firebase error (it seems) with token refresh and get currentUser.
Problem 1
For example, a user connects to my app, closes it after 5 minutes and reopens it the next day (the token has therefore expired, as its validity period is 1 hour).
In the back-end logs, I can see that some calls are made with a token that has been expired for several hours.
Given my code (that the token is checked before each call), I don't see how my api can receive calls with an expired token.
I also found that several other people potentially had similar concerns:
And apparently, the problem is only on iOS.
So I'm think that Firebase's token refresh function may have some problems.
Problem 2
Also, sometimes the currentUser is not retrieved with the function firebase.auth().currentUser; (returns null) even though I'm in the connected area.
This append on Android and iOS.
In my front, endpoint calls are handled simply:
(See the logic/code bellow)
Do I missing something or any idea ?
Thanks for reading
Project Files
Javascript
package.json
:iOS
Click To Expand
ios/Podfile
:# N/A
AppDelegate.m
:// N/A
Android
Click To Expand
Have you converted to AndroidX?
android/gradle.settings
jetifier=true
for Android compatibility?jetifier
for react-native compatibility?android/build.gradle
:// N/A
android/app/build.gradle
:// N/A
android/settings.gradle
:// N/A
MainApplication.java
:// N/A
AndroidManifest.xml
:<!-- N/A -->
Environment
Click To Expand
react-native info
output:react-native-firebase
version you're using that has this issue:20.1.0
Firebase
module(s) you're using that has the issue:"@react-native-firebase/app": "20.1.0"
"@react-native-firebase/app-check": "20.1.0"
"@react-native-firebase/auth": "20.1.0"
"@react-native-firebase/firestore": "20.1.0"
"@react-native-firebase/messaging": "20.1.0"
TypeScript
?YES
&~5.5.4
React Native Firebase
andInvertase
on Twitter for updates on the library.The text was updated successfully, but these errors were encountered: