fre*_*hme 7 google-signin flutter
我正在使用 google_sign_in 插件。
它运行良好。但我有一个问题。
我需要将 idToken 发送到后端服务器来验证用户。
但 Google 登录响应中的 IdToken 为空。
代码很简单
final GoogleSignInAccount googleUser = await _googleSignIn.signIn();
final GoogleSignInAuthentication googleAuth =
await googleUser.authentication;
print("Printing google user info");
print(googleAuth.accessToken);
print(googleAuth.idToken);
print(googleUser.displayName);
Run Code Online (Sandbox Code Playgroud)
其他属性具有正确的值。但 idToken 为空
我用谷歌搜索了这个并说我需要网络客户端 ID。
所以我做了
final _googleSignIn = GoogleSignIn(clientId: webClientId);
你们能帮忙吗?
我错过了什么吗?
moh*_*esR 10
https://firebase.google.com/docs/flutter/setup
我面对这个问题两天了,终于。(就我而言)这个解决方案有效。
https://firebase.flutter.dev/docs/installation/android#installing-your-firebase-configuration-file
添加com.google.gms:google-services为内部的依赖项android/build.gradle
dependencies {
// ... other dependencies
classpath 'com.google.gms:google-services:4.3.8'
}
}
Run Code Online (Sandbox Code Playgroud)
添加apply plugin: 'com.google.gms.google-services'/android/app/build.gradle
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7294 次 |
| 最近记录: |