When I click the button to login through Facebook, app just show loading and then disappear and this error is showing in the console.
I follow this tutorial: https://www.youtube.com/watch?v=u8H652UY-L8&ab_channel=RivaanRanawat
D/SurfaceView( 7613): UPDATE Surface(name=SurfaceView - com.example.fbandgauth/com.example.fbandgauth.MainActivity)/@0x7dc2330, mIsProjectionMode = false
I/System.out( 7613): [OkHttp] sendRequest<<
I/Timeline( 7613): Timeline: Activity_launch_request time:1432139064
D/DecorView: getWindowModeFromSystem windowmode is 1
E/libc ( 7613): Access denied finding property "ro.vendor.pref_scale_resolution"
I/Timeline( 7613): Timeline: Activity_launch_request time:1432139225
I/chatty ( 7613): uid=10351(com.example.fbandgauth) identical 2 lines
E/libc ( 7613): Access denied finding property "ro.vendor.pref_scale_resolution"
V/PhoneWindow( 7613): DecorView setVisiblity: visibility = 4, Parent = null, this = DecorView@cb2ded9[]
D/ViewRootImplFacebookActivity: hardware acceleration = true , fakeHwAccelerated = false, sRendererDisabled = false, forceHwAccelerated = false, sSystemRendererDisabled = false I/InputTransport( 7613): Create ARC handle: 0xb400006f23fa0880
V/PhoneWindow( 7613): DecorView setVisiblity: visibility = 0, Parent = android.view.ViewRootImpl@d18134c, this = DecorView@cb2ded9[FacebookActivity]
V/PhoneWindow( 7613): DecorView setVisiblity: visibility = 0, Parent = android.view.ViewRootImpl@ca7d709, this = DecorView@f17d0e[MainActivity]
V/PhoneWindow( 7613): DecorView setVisiblity: visibility = 4, Parent = android.view.ViewRootImpl@d18134c, this = DecorView@cb2ded9[FacebookActivity]
D/View ( 7613): [Warning] assignParent to null: this = DecorView@cb2ded9[FacebookActivity] I/InputTransport( 7613): Destroy ARC handle: 0xb400006f23fa0880
When Click on the button this function is called.
Future<String?> signInWithFacebook(BuildContext context) async {
try {
final LoginResult loginResult =
await FacebookAuth.instance.login(permissions: ['email']);
if (loginResult.status == LoginStatus.success) {
final OAuthCredential facebookAuthCredential =
FacebookAuthProvider.credential(loginResult.accessToken!.token);
UserCredential userCredential =
await _firebaseAuth.signInWithCredential(facebookAuthCredential);
if (userCredential.user != null) {
if (userCredential.additionalUserInfo!.isNewUser) {
context.read<AuthProvider>().saveGoogleUserDataToDB(
userName: userCredential.user!.displayName.toString(),
email: userCredential.user!.email.toString(),
password: '123456',
mobileNumber: userCredential.user!.phoneNumber.toString(),
profileURl: userCredential.user!.photoURL.toString(),
);
}
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => const IndexPage()),
);
}
return null;
} else if (loginResult.status == LoginStatus.cancelled) {
return 'Login cancelled';
} else {
return 'Error';
}
} on FirebaseAuthException catch (e) {
context.read<CustomSnackBars>().setCustomSnackBar(
title: 'Error',
message: e.message.toString(),
contentType: ContentType.failure,
context: context,
);
// showSnackBar(context, e.message!); // Displaying the error message
}
}
Package i use:
flutter_facebook_auth: ^4.4.0+1