mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Microsoft Sign-in: Add refresh token support (#1838)
This commit is contained in:
parent
e68a51dcff
commit
4b8ca158a8
3 changed files with 26 additions and 21 deletions
|
|
@ -211,7 +211,14 @@ namespace MinecraftClient
|
|||
if (result != ProtocolHandler.LoginResult.Success)
|
||||
{
|
||||
Translations.WriteLineFormatted("mcc.session_invalid");
|
||||
if (Settings.Password == "" && Settings.AccountType == ProtocolHandler.AccountType.Mojang)
|
||||
// Try to refresh access token
|
||||
if (!string.IsNullOrWhiteSpace(session.RefreshToken))
|
||||
{
|
||||
result = ProtocolHandler.MicrosoftLoginRefresh(session.RefreshToken, out session);
|
||||
}
|
||||
if (result != ProtocolHandler.LoginResult.Success
|
||||
&& Settings.Password == ""
|
||||
&& Settings.AccountType == ProtocolHandler.AccountType.Mojang)
|
||||
RequestPassword();
|
||||
}
|
||||
else ConsoleIO.WriteLineFormatted(Translations.Get("mcc.session_valid", session.PlayerName));
|
||||
|
|
@ -221,14 +228,14 @@ namespace MinecraftClient
|
|||
{
|
||||
Translations.WriteLine("mcc.connecting", Settings.AccountType == ProtocolHandler.AccountType.Mojang ? "Minecraft.net" : "Microsoft");
|
||||
result = ProtocolHandler.GetLogin(Settings.Login, Settings.Password, Settings.AccountType, out session);
|
||||
|
||||
if (result == ProtocolHandler.LoginResult.Success && Settings.SessionCaching != CacheType.None)
|
||||
{
|
||||
SessionCache.Store(Settings.Login.ToLower(), session);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result == ProtocolHandler.LoginResult.Success && Settings.SessionCaching != CacheType.None)
|
||||
{
|
||||
SessionCache.Store(Settings.Login.ToLower(), session);
|
||||
}
|
||||
|
||||
if (result == ProtocolHandler.LoginResult.Success)
|
||||
{
|
||||
Settings.Username = session.PlayerName;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue