flutterfire
flutterfire copied to clipboard
[FirebaseAuth]: Can't listen to Facebook login
Is there an existing issue for this?
- [X] I have searched the existing issues.
Which plugins are affected?
Auth
Which platforms are affected?
Web
Description
I can listen to Google sign in + custom Email & password sign in. But, Facebook doesn't call the authStateChanges listener
FirebaseAuth.instance.authStateChanges().listen((User? user)
I can see that the proper User data is returned in the API responses though.
Future<UserCredential> signInWithFacebook() async {
isFaceBookAuth = true;
FacebookAuthProvider facebookProvider = FacebookAuthProvider();
facebookProvider.addScope('email');
facebookProvider.setCustomParameters({
'display': 'popup',
});
return await FirebaseAuth.instance.signInWithPopup(facebookProvider);
}
Reproducing the issue
void listenToAuthStates() {
listener = FirebaseAuth.instance.authStateChanges().listen((User? user) {
if (user == null) {
print('User is currently signed out!');
} else {
print('User is signed in!' + "uid= " + user.uid);
}
}
});
}
Future<UserCredential> signInWithFacebook() async {
FacebookAuthProvider facebookProvider = FacebookAuthProvider();
facebookProvider.addScope('public_profile');
facebookProvider.setCustomParameters({
'display': 'popup',
});
return await FirebaseAuth.instance.signInWithPopup(facebookProvider);
}
Firebase Core version
3.1.1
Flutter Version
3.22.2
Relevant Log Output
No response
Flutter dependencies
Expand Flutter dependencies snippet
Replace this line with the contents of your `flutter pub deps -- --style=compact`.
Additional context and comments
No response