Update MicrosoftSession.java

This commit is contained in:
ShirosakiMio 2024-08-19 10:13:52 +08:00
parent 70222c93d2
commit f9f204bf36
1 changed files with 1 additions and 1 deletions

View File

@ -88,7 +88,7 @@ public class MicrosoftSession {
.orElseThrow(() -> new IllegalArgumentException("accessToken is missing")); .orElseThrow(() -> new IllegalArgumentException("accessToken is missing"));
String refreshToken = tryCast(storage.get("refreshToken"), String.class) String refreshToken = tryCast(storage.get("refreshToken"), String.class)
.orElseThrow(() -> new IllegalArgumentException("refreshToken is missing")); .orElseThrow(() -> new IllegalArgumentException("refreshToken is missing"));
Long notAfter = tryCast(storage.get("notAfter"), Long.class).orElse(0L); Long notAfter = tryCast(storage.get("notAfter"), Number.class).map(Number::longValue).orElse(0L);
String userId = tryCast(storage.get("userid"), String.class) String userId = tryCast(storage.get("userid"), String.class)
.orElseThrow(() -> new IllegalArgumentException("userid is missing")); .orElseThrow(() -> new IllegalArgumentException("userid is missing"));
return new MicrosoftSession(tokenType, accessToken, notAfter, refreshToken, new User(userId), new GameProfile(uuid, name)); return new MicrosoftSession(tokenType, accessToken, notAfter, refreshToken, new User(userId), new GameProfile(uuid, name));