2

I have the user login in the firebase but the email is getting null I saw the Facebook developer panel but can't find anything specific about that. Here is the screenshot of my firebase.enter image description here

Also when the user login to the application a notification shows on Facebook.

That's a notification from Facebook

zain ishfaq
  • 105
  • 1
  • 7

2 Answers2

4

For me, this issue was solved by requesting Advanced Access to the email permission in the Facebook for Developer's app.

In your Facebook developers profile, select your app and navigate to App Review -> Permissions and Features -> Click on Request Advanced Access for email

AkshayDoshi
  • 130
  • 10
  • What is the difference between Standard and Advanced Access? – naheliegend Dec 30 '21 at 09:30
  • @naheliegend As per [Facebook Developers Documentation](https://developers.facebook.com/docs/graph-api/overview/access-levels/) , `If your app will only be used by people who have a role on it, the permissions and features your app requires will only need Standard Access. If your app will be used by people who do not have a role on it, the permissions and features that your app requires will need Advanced Access.` – AkshayDoshi Dec 31 '21 at 10:12
  • Thank you! Ist the Development <-> Live mode replaced by the Access control? – naheliegend Dec 31 '21 at 15:01
  • I don't think that's the case. I can still see the Development Mode/Live Mode toggle in the Facebook's App Dashboard. – AkshayDoshi Jan 02 '22 at 11:00
2

I have used this function for Facebook Login in Flutter. Check the below code.

The plugin i used is flutter_facebook_auth: ^3.4.0.

Future<void> facebookLogin(){

 final result = await FacebookAuth.instance
          .login(permissions: ["email", "public_profile"]);

      if (result.status == LoginStatus.success) {

        final OAuthCredential credential =
            FacebookAuthProvider.credential(result.accessToken.token);

        final userObj = await FirebaseAuth.instance
            .signInWithCredential(credential); 

        print("Facebook Data with Credentials -> ${userObj.user.toString()}");
       
         
           final email =  userObj.user.providerData[0].email;
           
           final displayName = userObj.user.providerData[0].displayName;
}

}

Otherwise you can share your code.

Faizan Darwesh
  • 301
  • 1
  • 5
  • The same thing happened email is getting null... but when I log in to the developer account only then I got the email. Is there another way to solve that – zain ishfaq Oct 16 '21 at 07:22