BUGFIX:绑定谷歌;

This commit is contained in:
shahaibo
2025-02-05 13:38:10 +08:00
parent 627f264ef3
commit 9e5d2f47e2

View File

@@ -2240,7 +2240,6 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
@Override @Override
public AccountLoginVO parseGoogleCredential(String credential, Integer type) { public AccountLoginVO parseGoogleCredential(String credential, Integer type) {
try {
// 配置 Google ID Token 验证器 // 配置 Google ID Token 验证器
GoogleIdTokenVerifier verifier = new GoogleIdTokenVerifier.Builder( GoogleIdTokenVerifier verifier = new GoogleIdTokenVerifier.Builder(
new NetHttpTransport(), new NetHttpTransport(),
@@ -2249,7 +2248,14 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
.build(); .build();
// 验证并解析 ID Token // 验证并解析 ID Token
GoogleIdToken idToken = verifier.verify(credential); GoogleIdToken idToken = null;
try {
idToken = verifier.verify(credential);
} catch (GeneralSecurityException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
if (idToken != null) { if (idToken != null) {
@@ -2349,11 +2355,6 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
} else { } else {
throw new IllegalArgumentException("Invalid ID token."); throw new IllegalArgumentException("Invalid ID token.");
} }
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("Failed to verify ID token: " + e.getMessage());
}
} }
private static final String WECHAT_ACCESS_TOKEN_URL = private static final String WECHAT_ACCESS_TOKEN_URL =