I am using Facebook Login in my Flutter app. I have followed the implementation steps and my app successfully brings up a Facebook Login dialogue and returns an access token on successful login. I don't think the user is actually authenticated on Firebase yet: No new user is listed in the Authentication/Users page on the Firebase console, and calling FirebaseUser user returns null.
The documentation on FlutterFire (https://firebase.flutter.dev/docs/auth/social/) provides this method for authenticating the user on Firebase:
import 'package:flutter_facebook_auth/flutter_facebook_auth.dart';
Future<UserCredential> signInWithFacebook() async {
// Trigger the sign-in flow
final LoginResult result = await FacebookAuth.instance.login();
// Create a credential from the access token
final FacebookAuthCredential facebookAuthCredential =
FacebookAuthProvider.credential(result.accessToken.token);
// Once signed in, return the UserCredential
return await FirebaseAuth.instance.signInWithCredential(facebookAuthCredential);
}
I have added this method to my app. The problem is that even though I have the right package in my pubspec.yaml...
dependencies:
flutter_facebook_auth: "^1.0.0"
...I am getting these errors on the code from FlutterFire:
" Undefined class 'FacebookAuthCredential' "
and
" The method 'credential' isn't defined for the type 'FacebookAuthProvider'. "
Other methods from flutter_facebook_auth work fine, though (eg FacebookAuth.instance.login())
I would appreciate any help!