如何使用Google和Firebase检测首次身份验证?

时间:2019-03-28 17:50:08

标签: firebase flutter firebase-authentication google-authentication

我想知道如何检测用户首次通过我的应用程序进入google(因为我需要询问一些其他信息)。 我的代码:

void _submitGoogle() async {
    final GoogleSignInAccount googleUser = await _googleSignIn.signIn();

    final GoogleSignInAuthentication googleAuth = await googleUser.authentication;

    final AuthCredential credential = await GoogleAuthProvider.getCredential(
      idToken: googleAuth.idToken,
      accessToken: googleAuth.accessToken,
    );

    final FirebaseUser user = await _auth.signInWithCredential(credential);

    assert(user.email != null);
    assert(user.displayName != null);
    assert(user.isAnonymous != null);
    assert(await user.getIdToken() != null);

  }

0 个答案:

没有答案