简体   繁体   中英

Firebase createUser and signIn gives warnings in console - react-native

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.

Please update to the latest firebase SDK version. Some of the sign-in method will be deprecated eventually. The warning is to let you switch to new APIs before it's deprecated so it won't break your app when we deprecated them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM