Firebase Google Auth无法正常工作。 ApiException:12500 :,空

时间:2019-07-16 08:13:19

标签: android firebase flutter dart google-signin

是 一切都在火场和颤抖中设置得很好 1)在Firebase项目中添加了最新的SHA-1指纹 2)启用了Google登录选项 3)添加了受支持的电子邮件

该应用仍在调试中 添加了调试密钥SHA-1

什么都没做

我只是试图设置一个我无法使用的简单Google Auth登录

我遇到此错误

PlatformException(sign_in_failed,com.google.android.gms.common.api.ApiException:12500:,null)

`

final FirebaseAuth auth = FirebaseAuth.instance;
  final GoogleSignIn googleSignIn = new GoogleSignIn();

  GoogleSignInAuthentication googleAuth;


  Future<FirebaseUser> SignInWithGoogleAuth() async {

    GoogleSignInAccount GSA = await googleSignIn.signIn();
//I'm getting error here  ^^ at the above line code
     googleAuth = await GSA.authentication;
     AuthCredential credential = GoogleAuthProvider.getCredential(
      accessToken: googleAuth.accessToken,
      idToken: googleAuth.idToken,
    );
     FirebaseUser user = await auth.signInWithCredential(credential);
    assert(user.email != null);
    assert(user.displayName != null);
    assert(!user.isAnonymous);
    assert(await user.getIdToken() != null);
    final FirebaseUser currentUser = await auth.currentUser();
    assert(user.uid == currentUser.uid);
    print('signInWithGoogle succeeded: $user');
    return currentUser;

  }

错误:

SetAppTypeFace- try to flip, app = borse.coaching_app
V/Monotype(22482):     Typeface getFontPathFlipFont - systemFont = default#default

E/flutter (22482): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled 

Exception: **PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 12500: , null)**


E/flutter (22482): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:564:7)
E/flutter (22482): #1      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:302:33)
E/flutter (22482): <asynchronous suspension>
E/flutter (22482): #2      GoogleSignIn._callMethod (package:google_sign_in/google_sign_in.dart:226:58)
E/flutter (22482): <asynchronous suspension>
E/flutter (22482): #3      GoogleSignIn._addMethodCall (package:google_sign_in/google_sign_in.dart:268:20)
E/flutter (22482): #4      GoogleSignIn.signIn (package:google_sign_in/google_sign_in.dart:339:48)
E/flutter (22482): #5      _StartingPageState.SignInWithGoogleAuth (package:coaching_app/pages/startingPage.dart:27:50)
E/flutter (22482): <asynchronous suspension>
E/flutter (22482): #6      _StartingPageState.GoogleImg.<anonymous closure> (package:coaching_app/pages/startingPage.dart:141:26)
E/flutter (22482): <asynchronous suspension>
E/flutter (22482): #7      _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:511:14)
E/flutter (22482): #8      _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:566:30)
E/flutter (22482): #9      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:166:24)
E/flutter (22482): #10     TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:240:9)
E/flutter (22482): #11     TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:177:9)
E/flutter (22482): #12     PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:436:9)
E/flutter (22482): #13     PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:73:12)
E/flutter (22482): #14     PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:11)
E/flutter (22482): #15     _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:221:19)
E/flutter (22482): #16     _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:199:22)
E/flutter (22482): #17     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7)
E/flutter (22482): #18     _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7)
E/flutter (22482): #19     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7)
E/flutter (22482): #20     _rootRunUnary (dart:async/zone.dart:1136:13)
E/flutter (22482): #21     _CustomZone.runUnary (dart:async/zone.dart:1029:19)
E/flutter (22482): #22     _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
E/flutter (22482): #23     _invoke1 (dart:ui/hooks.dart:233:10)
E/flutter (22482): #24     _dispatchPointerDataPacket (dart:ui/hooks.dart:154:5)
E/flutter (22482):

1 个答案:

答案 0 :(得分:0)

我很长时间出现此错误 ApiException:12500 。我已经尝试了一切:

  • 删除我的debugkeystore,重新创建一个
  • 在Firebase控制台上添加支持电子邮件
  • 更改插件版本
  • 在我的设备上更新google

什么都没有,但寻找我发现的解决方案:

我转到了此页面(https://console.developers.google.com/apis/credential s) 从列表中选择您的项目(左上方)。然后转到“ Oauth同意屏幕”

我在应用程序的主页上填写了应用程序的徽标和链接,并在应用程序的隐私权政策链接(带有project.firebaseapp.com)上进行了保存,

enter image description here

那之后很好。我相信官方文档应该更新。

有关更多信息,请访问此链接 enter link description here