BUGFIX:绑定谷歌;
This commit is contained in:
@@ -2240,7 +2240,6 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
|
||||
@Override
|
||||
public AccountLoginVO parseGoogleCredential(String credential, Integer type) {
|
||||
try {
|
||||
// 配置 Google ID Token 验证器
|
||||
GoogleIdTokenVerifier verifier = new GoogleIdTokenVerifier.Builder(
|
||||
new NetHttpTransport(),
|
||||
@@ -2249,7 +2248,14 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
.build();
|
||||
|
||||
// 验证并解析 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) {
|
||||
@@ -2349,11 +2355,6 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
} else {
|
||||
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 =
|
||||
|
||||
Reference in New Issue
Block a user