feat(auth): 接入 Google 登录
- 登录页保留邮箱与 Google 两个入口,Google 按钮按官方规范改为白底四色图标 - 新增 GoogleAuthService:封装 initialize/authenticate,失败以结果对象返回 - AuthApi 增加 googleLogin,AuthController 增加 signInWithGoogle - iOS 补充 CFBundleURLTypes 与 GIDClientID,Bundle ID 统一为 com.stormg.lumadrama - Google 请求期间按钮显示转圈并禁止重复点击
This commit is contained in:
1 parent
7b90bd59b9
commit
67670d46b1
18 files changed
+335
-55
No files matched your search
@@ -125,6 +125,29 @@ class AuthApi {
|
||||
return AuthSession.fromJson((data as Map).cast<String, dynamic>());
|
||||
}
|
||||
|
||||
/// Google 登录:把客户端拿到的 idToken 交给后端校验并换发令牌。
|
||||
///
|
||||
/// 账号按 Google 返回的邮箱归并:邮箱已存在则直接登入,不存在则自动建号。
|
||||
Future<AuthSession> googleLogin({
|
||||
required String idToken,
|
||||
required String deviceId,
|
||||
String platform = '',
|
||||
String osVersion = '',
|
||||
String appVersion = '',
|
||||
}) async {
|
||||
final data = await _client.post(
|
||||
'/app/auth/google',
|
||||
body: {
|
||||
'idToken': idToken,
|
||||
'deviceId': deviceId,
|
||||
'platform': platform,
|
||||
'osVersion': osVersion,
|
||||
'appVersion': appVersion,
|
||||
},
|
||||
);
|
||||
return AuthSession.fromJson((data as Map).cast<String, dynamic>());
|
||||
}
|
||||
|
||||
Future<AuthSession> refresh(
|
||||
String refreshToken, {
|
||||
String platform = '',
|
||||
|
||||
Reference in new issue
Block a user