I am using firebase auth and google sign in package and flutter facebook auth package
I am able to get the email id value when using google sign in but not getting it while using facebook sign in
here is the code
google_sigincontrol.dart
final googleSignIn = GoogleSignIn();
GoogleSignInAccount ? _user;
GoogleSignInAccount get user => _user!;
Future facebookLogin() async {
final LoginResult result = await FacebookAuth.instance.login();
if (result.status == LoginStatus.success) {
final OAuthCredential credential = FacebookAuthProvider.credential(result.accessToken!.token);
return await FirebaseAuth.instance.signInWithCredential(credential);
}
notifyListeners();
}
Future googleLogin() async {
final googleUser = await googleSignIn.signIn();
if (googleUser == null) return;
_user = googleUser;
final googleAuth = await googleUser.authentication;
final credential = GoogleAuthProvider.credential(
accessToken: googleAuth.accessToken,
idToken: googleAuth.idToken,
);
await FirebaseAuth.instance.signInWithCredential(credential);
notifyListeners();
}
screen.dart
final user = FirebaseAuth.instance.currentUser!;
CircleAvatar(
radius: 40,
backgroundImage: NetworkImage(user.photoURL!),
),
SizedBox(height: 8),
Text('Name: '+ user.displayName!,
style: TextStyle(color: Colors.black,fontSize: 16),
),
SizedBox(height: 8),
Text('Email: '+ user.email!,
style: TextStyle(color: Colors.black,fontSize: 16),
),
Can anyone provide a fix for this