Here are some examples of how to replace the deprecated authentication methods.
The examples are assuming the use of the default firebase app instance (named '[DEFAULT]'). You can pass auth()
an initialized firebase app in order to have the auth service associated with a different app instance.
Ex.
var firebase = require('firebase/app');
require('firebase/auth');
var myApp = firebase.initializeApp(yourConfig, 'myApp');
var myAppAuth = firebase.auth(myApp);
var firebase = require('firebase/app');
require('firebase/auth');
var app = firebase.initializeApp(yourConfig);
app.auth().signInWithEmailAndPassword(email, password).then(user => {
//
});
See Firebase docs for more information.
var firebase = require('firebase/app');
require('firebase/auth');
var app = firebase.initializeApp(yourConfig);
app.auth().onAuthStateChanged(function(user, error) {
//
});
See Firebase docs for more information.
var firebase = require('firebase/app');
require('firebase/auth');
var app = firebase.initializeApp(yourConfig);
app.auth().signOut().then(() => {
//return value is null
});
See Firebase docs for more information.
var firebase = require('firebase/app');
require('firebase/auth');
var app = firebase.initializeApp(yourConfig);
app.auth().currentUser;
See Firebase docs for more information.
var firebase = require('firebase/app');
require('firebase/auth');
var app = firebase.initializeApp(yourConfig);
app.auth().createUserWithEmailAndPassword(email,password).then(user => {
//
});
See Firebase Docs for more information.
var firebase = require('firebase/app');
require('firebase/auth');
var app = firebase.initializeApp(yourConfig);
app.auth().sendPasswordResetEmail(email).then(...)
See Firebase Docs for more information.
var firebase = require('firebase/app');
require('firebase/auth');
var app = firebase.initializeApp(yourConfig);
app.auth().signInWithCustomToken(token).then(user => {
//
})
See Firebase Docs for more information.
var firebase = require('firebase/app');
require('firebase/auth');
var app = firebase.initializeApp(yourConfig);
var provider = new firebase.auth.FacebookAuthProvider();
app.auth().signInWithPopup(provider).then(() => {
//return value is null
});
See Firebase Docs for more information.
var firebase = require('firebase/app');
require('firebase/auth');
var app = firebase.initializeApp(yourConfig);
app.auth().getRedirectResult().then(function(result) {
//
});
See Firebase Docs for more information.
var firebase = require('firebase/app');
require('firebase/auth');
var app = firebase.initializeApp(yourConfig);
var provider = new firebase.auth.FacebookAuthProvider();
var credential = provider.credential(OAuthToken, settings);
auth.signInWithCredential(credential).then(user => {
//
});
See Firebase Docs
var firebase = require('firebase/app');
require('firebase/auth');
var app = firebase.initializeApp(yourConfig);
var provider = new firebase.auth.FacebookAuthProvider();
app.auth().signInWithRedirect(provider).then(() => {
//return value is null
});
See Firebase Docs for more information.