logInWithFacebookWeb method

Future<void> logInWithFacebookWeb()

Starts the Sign In with Facebook Flow.

Throws a LogInWithGoogleFailure if an exception occurs.

Implementation

Future<void> logInWithFacebookWeb() async {
  try {
    // Create a new provider
    final facebookProvider = FacebookAuthProvider()
      ..addScope('email')
      ..setCustomParameters(<String, dynamic>{
        'display': 'popup',
      });

    // Once signed in, return the UserCredential
    await _firebaseAuth.signInWithPopup(facebookProvider);
  } on FirebaseAuthException catch (e) {
    throw LogInWithGoogleFailure.fromCode(e.code);
  } catch (_) {
    throw const LogInWithGoogleFailure();
  }
}