标签云

微信群

扫码加入我们

WeChat QR Code

I was building a login cum signup screen in react-native where it takes email and password from the user and tries to signin using the firebase call

firebase.auth().signInWithEmailAndPassword(email, password)

and if it fails to login then I create a new account for the user using the call

firebase.auth().createUserWithEmailAndPassword(email, password)

When I run the app on emulator and try to sign in it works fine but I get a yellow box warning saying

Deprecated firebase.User.prototype.signInWithEmailAndPassword in favor of firebase.User.prototype.signInAndRetrieveDataWithEmailAndPassword

I get a similar type of error for the createUser method. What difference will it make if I replace my methods with the ones suggested by the warnings?

Also I get a warning for the firebase initialization call which is firebase.initializeApp(config); saying

Deprecation: Calling 'InitializeApp()' for apps that are already initialised natively is unnecessary, use 'firebase.app()' instead to access the already initialized default app instance.

But when I actually change the initialization call to firebase.app(config) it throws me an error

TypeError: undefined is not a function.

For now, I have completely disabled the yellow box. Please let me know if there is any other workaround for this.


Is there any difference between the methods like the new ones say retrieve data. Does it make any difference to the data returned?

2018年08月18日35分38秒

It depends on the version you are using. Before v5.0, signIn methods without 'retrieveData' only return a user object and those with 'retrieveData' return AuthResult . After 5.0, they both return AuthResult, but methods with retrieveData will be deprecated.

2018年08月18日35分38秒

Oh yes my app uses any version above 4.1.0 so I guess it installs the latest version only but then why does it ask me to use retrieveData when they are being deprecated in the newer versions.

2018年08月19日35分38秒

I think you are using version <= 5.0. We tried to let people use the methods which return AuthResult while signInWith*** only return User before 5.0.

2018年08月18日35分38秒

Oh I guess that's the case with me. I get a user object that has the uid and stuff. Thanks for the answer but then what about the initialize method?

2018年08月18日35分38秒