I try to use google provider to log in to my angular nativescript app. My web app works properly, for mobile added SHA-1 to firebase console.
I have two problems:
- After try to log in with google provider firebaseWebApi.auth().onAuthStateChanged not fired (login function returns User properly).
- When Sign-in with google provider is not possible I try to simply log in with firebaseWebApi.auth().signInWithEmailAndPassword(), but I have an error message: "Logging in the user failed. com.google.firebase.auth.FirebaseAuthRecentLoginRequiredException: This operation is sensitive and requires recent authentication. Log in again before retrying this request."
It's weird because without trying to log in with google provider, signInWithEmailAndPassword works properly.
public async startLoginGoogle(): Promise<firebase.auth.UserCredential> {
const user = await firebase.login({
type: firebase.LoginType.GOOGLE
});
// user with getIdTokenResult() is available here
return user.getIdTokenResult();
}
firebaseWebApi.auth().onAuthStateChanged((user: firebase.User) => {
// nothing
subject.next(user);
});
Any idea?