You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey guys, could you provide a version of your dependency to be used with Firebase Auth?
I'm using this code for Google SignIn and signout, but FB has different classes and methods and I'm not sure how to integrate with flutter.
Sorry, I've started with Flutter and Dart only for the past 4 weeks.
class AuthService {
final FirebaseAuth _auth = FirebaseAuth.instance;
final GoogleSignIn _googleSignIn = new GoogleSignIn();
// Create user object based on FirebaseUser
User _userFromFirebaseUser(FirebaseUser user) {
return user != null ? User(uid: user.uid) : null;
}
// Auth change user stream
Stream<User> get user {
return _auth.onAuthStateChanged.map(
_userFromFirebaseUser);
}
// SignIn with Facebook
Future signInFacebook() async {}
// SignIn with Google
Future signInGoogle() async {
GoogleSignInAccount googleSignInAccount = await _googleSignIn.signIn();
GoogleSignInAuthentication googleSignInAuthentication =
await googleSignInAccount.authentication;
AuthCredential credential = GoogleAuthProvider.getCredential(
idToken: googleSignInAuthentication.idToken,
accessToken: googleSignInAuthentication.accessToken);
try {
AuthResult result = (await _auth.signInWithCredential(credential));
FirebaseUser user = result.user;
return _userFromFirebaseUser(user);
} catch (e) {
print(e.toString());
return null;
}
}
// SignOut
Future signOut() async {
try {
return await _auth.signOut();
} catch (e) {
print(e.toString());
return null;
}
}
}
The text was updated successfully, but these errors were encountered:
Hey!
Check out this issue #16, does it resolve your problem?
Guys, you are superstars.
Your dependency and your prompt answers to my Firebase question have solved my FB problem in 1hour.
I've been trying to use other flutter FB dependencies and all f***ing failed.
Love it love it love it. Thanks a lot!
Hey guys, could you provide a version of your dependency to be used with Firebase Auth?
I'm using this code for Google SignIn and signout, but FB has different classes and methods and I'm not sure how to integrate with flutter.
Sorry, I've started with Flutter and Dart only for the past 4 weeks.
The text was updated successfully, but these errors were encountered: