gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 21:00:50 71 4
gpt4 key购买 nike

我已经搜索了整个互联网,尝试了所有可能的解决方案,但我仍然无法从我的 flutter 应用程序中使用 GoogleSignIn 登录。

我尝试过的事情:
1.新增SHA-1证书
2.新增SHA-256证书
3. 填写 O-Auth 屏幕
4. 在 Firebase 中启用 GoogleSignIn
5.增加支持邮件

目前仅在 Debug模式下进行测试。由于该应用程序目前处于初始阶段,我还不想构建发布版本。使用调试 SHA-1 和 SHA-256 指纹。

Future<FirebaseUser> _signIn(BuildContext context) async {
final GoogleSignInAccount googleUser = await _googleSignIn.signIn();
final GoogleSignInAuthentication googleAuth =
await googleUser.authentication;

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

AuthResult userDetails =
await _firebaseAuth.signInWithCredential(credential);
ProviderDetails providerInfo =
ProviderDetails(userDetails.user.providerId);

List<ProviderDetails> providerData = List<ProviderDetails>();
providerData.add(providerInfo);

UserDetails details = UserDetails(
providerDetails: userDetails.user.providerId,
userEmail: userDetails.user.email,
userName: userDetails.user.displayName,
photoUrl: userDetails.user.photoUrl,
providerData: providerData);

return userDetails.user;
}

我得到的错误
[ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: 
PlatformException(sign_in_failed,
com.google.android.gms.common.api.ApiException: 10: , null)
E/flutter (12322): #0 StandardMethodCodec.decodeEnvelope
package:flutter/…/services/message_codecs.dart:564
E/flutter (12322): #1 MethodChannel.invokeMethod
package:flutter/…/services/platform_channel.dart:316
E/flutter (12322): <asynchronous suspension>
E/flutter (12322): #2 MethodChannel.invokeMapMethod
package:flutter/…/services/platform_channel.dart:344
E/flutter (12322): <asynchronous suspension>
E/flutter (12322): #3 GoogleSignIn._callMethod
package:google_sign_in/google_sign_in.dart:218
E/flutter (12322): <asynchronous suspension>
E/flutter (12322): #4 GoogleSignIn._addMethodCall.<anonymous closure>
package:google_sign_in/google_sign_in.dart:27
E/flutter (12322): #5 _rootRun (dart:async/zone.dart:1120:38)
E/flutter (12322): #6 _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter (12322): #7 _FutureListener.handleWhenComplete
(dart:async/future_impl.dart:150:18)
E/flutter (12322): #8
Future._propagateToListeners.handleWhenCompleteCallback
(dart:async/future_impl.dart:609:39)
E/flutter (12322): #9 Future._propagateToListeners
(dart:async/future_impl.dart:665:37)
E/flutter (12322): #10 Future._addListener.<anonymous closure>
(dart:async/future_impl.dart:348:9)
E/flutter (12322): #11 _rootRun (dart:async/zone.dart:1124:13)
E/flutter (12322): #12 _CustomZone.run (dart:async/zone.dart:1021:19)
E/flutter (12322): #13 _CustomZone.runGuarded
(dart:async/zone.dart:923:7)
E/flutter (12322): #14 _CustomZone.bindCallbackGuarded.<anonymous
closure> (dart:async/zone.dart:963:23)
E/flutter (12322): #15 _microtaskLoop
(dart:async/schedule_microtask.dart:41:21)
E/flutter (12322): #16 _startMicrotaskLoop
(dart:async/schedule_microtask.dart:50:5)
E/flutter (12322):

最佳答案

我知道这个问题是很久以前发布的,但如果其他人有问题,除了上述所有步骤之外,我还启用了 Google People API。确保您使用正确的电子邮件和项目。

https://console.developers.google.com/apis/library/people.googleapis.com?q=people&id=5877a7af-1d13-4098-a53e-b5e2d7a87a4f&project=phamton-test

关于android - PlatformException(sign_in_failed,com.google.android.gms.common.api.ApiException : 10: , null),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57776534/

71 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com