-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
RNFirebaseAuth.getToken got 2 arguments, expected 3 #42
Comments
Can I see your code where you call |
lib/firebase.js let firebaseInitialized = false;
const firebase = new RNFirebase();
firebase.auth().onAuthStateChanged((user) => {
firebaseInitialized = true;
});
export const getToken = (forceRefresh = false) => {
if (firebaseInitialized) {
if (!firebase.auth()) return Promise.resolve(null);
let currentUser = firebase.auth().currentUser;
if (!currentUser) return Promise.resolve(null);
return currentUser.getToken(forceRefresh).then((token) => token);
} else {
return Promise.delay(100).then(() => getToken(forceRefresh));
}
} on my app initialization: getToken() |
I am waiting for the onAuthStateChanged, to ensure that the currentUser exists, as recommended by the firebase. https://firebase.google.com/docs/auth/web/manage-users#get_the_currently_signed-in_user
|
@gabrielmoreira Have you had anymore luck on this? I'd suggest wiping node_modules and reinstalling. Your code AFAIK looks ok, nothing fancy going on. |
Closing due to inactivity, can confirm this works currently unless this is some weird edge case. Issues like this tend to happen when yarn.lock is incorrectly installing the older versions of RNFirebase |
try |
@suwu150 I reach for this now |
any one has the solution for this facing this issue from 2days, didn't get any solution |
@nikilarigela make sure you have done |
I have cleaned the build and cleared all cache, nothing works |
With apologies, I won't reply further. For the avoidance of all doubt: you have a local project problem. They should work, and show the modules work. Why is your project not working? It could be nearly anything, it's impossible for us to effectively provide support for the infinite variety of ways a specific project may have a problem, so we provide samples and templates instead, to produce reproductions from known-good starts https://stackoverflow.com/help/minimal-reproducible-example - if you can provide a minimal reproducible example showing the failure, we may revisit. |
Updated react native, working now |
@nikilarigela what versions of firebase / rn did you settle on? facing the same issue on android device |
Go for current + current, that is, rnfb 14.5.1, react-native 0.67.3 - the changelog here will help you https://invertase.io/blog/react-native-firebase-versioning, and https://react-native-community.github.io/upgrade-helper/ will hook you up for react-native |
I am using Codepush and have made some updates on firebase modules, which led to that error. Indeed Codepush doesn't deploy native code changes (It deploys only javascript code). In my case, I released a new apk and it started working again ! |
Sometimes this error occurs when opening the app. I did not identify the cause. I suppose it is related to the expired token of the firebase, since it usually happens after a while that I get without opening the app.
I'm using react-native 0.42 and react-native-firebase 1.0.0-alpha12.
The text was updated successfully, but these errors were encountered: