Reputation: 305
I am trying to do authentication to firebase server to get the details I used this when I was using angular 1.6
var fbRef = new Firebase(decodedUtSession.fburl);
fbRef.authWithCustomToken(decodedUtSession.fbtkn, function(error, authData) {
$rootScope.fbRef = fbRef;
if(error){
console.log("Firebase Login Failed!", error);
}
});
But Now I am upgrading my app to angular 6 with @angular/fire for firebase I tried the below code for custom auth but I am always getting invalidAuthTokeb though token is valid and working fine with the angular 1.6 app.
import { AngularFireAuth } from '@angular/fire/auth';
import { FirebaseAuth } from '@angular/fire';
constructor(private afAuth: AngularFireAuth) { }
this.afAuth.auth.signInWithCustomToken(devToken).then((data) => {
console.log(data);
});
Can anyone please help me how to do authentication in a proper way TIA.
Upvotes: 0
Views: 1889
Reputation: 305
Angular 2+ uses Firebase SDK3.0, so backend should also be upgraded to have authentication.
Upvotes: 0