fix: fix user info

This commit is contained in:
G-XD 2024-01-19 11:49:35 +08:00
parent 72e4a1d846
commit 988d3cd293
2 changed files with 7 additions and 2 deletions

View File

@ -112,6 +112,11 @@
<artifactId>jjwt-impl</artifactId> <artifactId>jjwt-impl</artifactId>
<version>${jwt.version}</version> <version>${jwt.version}</version>
</dependency> </dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<version>${jwt.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.bouncycastle</groupId> <groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk18on</artifactId> <artifactId>bcpkix-jdk18on</artifactId>

View File

@ -51,7 +51,7 @@ public class AuthAppleRequest extends AuthDefaultRequest {
@Override @Override
protected AuthToken getAccessToken(AuthCallback authCallback) { protected AuthToken getAccessToken(AuthCallback authCallback) {
if (authCallback.getError() != null) { if (!StringUtils.isEmpty(authCallback.getError())) {
throw new AuthException(authCallback.getError()); throw new AuthException(authCallback.getError());
} }
this.config.setClientSecret(this.getToken()); this.config.setClientSecret(this.getToken());
@ -67,7 +67,7 @@ public class AuthAppleRequest extends AuthDefaultRequest {
.idToken(accessTokenObject.getString("id_token")); .idToken(accessTokenObject.getString("id_token"));
if (!StringUtils.isEmpty(authCallback.getUser())) { if (!StringUtils.isEmpty(authCallback.getUser())) {
try { try {
AppleUserInfo userInfo = JSONObject.parseObject(response, AppleUserInfo.class); AppleUserInfo userInfo = JSONObject.parseObject(authCallback.getUser(), AppleUserInfo.class);
builder.username(userInfo.getName().getFirstName() + " " + userInfo.getName().getLastName()); builder.username(userInfo.getName().getFirstName() + " " + userInfo.getName().getLastName());
} catch (Exception ignored) { } catch (Exception ignored) {
} }