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
|
|
@ -14,6 +14,7 @@ namespace MinecraftClient.Protocol.Session
|
|||
public string PlayerName { get; set; }
|
||||
public string PlayerID { get; set; }
|
||||
public string ClientID { get; set; }
|
||||
public string RefreshToken { get; set; }
|
||||
|
||||
public SessionToken()
|
||||
{
|
||||
|
|
@ -21,11 +22,12 @@ namespace MinecraftClient.Protocol.Session
|
|||
PlayerName = String.Empty;
|
||||
PlayerID = String.Empty;
|
||||
ClientID = String.Empty;
|
||||
RefreshToken = String.Empty;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Join(",", ID, PlayerName, PlayerID, ClientID);
|
||||
return String.Join(",", ID, PlayerName, PlayerID, ClientID, RefreshToken);
|
||||
}
|
||||
|
||||
public static SessionToken FromString(string tokenString)
|
||||
|
|
@ -39,6 +41,7 @@ namespace MinecraftClient.Protocol.Session
|
|||
session.PlayerName = fields[1];
|
||||
session.PlayerID = fields[2];
|
||||
session.ClientID = fields[3];
|
||||
session.RefreshToken = fields[4];
|
||||
|
||||
Guid temp;
|
||||
if (!JwtRegex.IsMatch(session.ID))
|
||||
|
|
@ -49,6 +52,7 @@ namespace MinecraftClient.Protocol.Session
|
|||
throw new InvalidDataException("Invalid player ID");
|
||||
if (!Guid.TryParseExact(session.ClientID, "N", out temp))
|
||||
throw new InvalidDataException("Invalid client ID");
|
||||
// No validation on refresh token because it is custom format token (not Jwt)
|
||||
|
||||
return session;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue