Skip to content

Commit

Permalink
add UserType property in MSession.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaBs committed Oct 3, 2021
1 parent 3c35202 commit 45b0b3c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions CmlLib/Core/Auth/MLogin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ private MLoginResponse parseSession(string json, string? clientToken)
AccessToken = job["accessToken"]?.ToString(),
UUID = profile["id"]?.ToString(),
Username = profile["name"]?.ToString(),
UserType = "Mojang",
ClientToken = clientToken
};

Expand Down
9 changes: 6 additions & 3 deletions CmlLib/Core/Auth/MSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ public class MSession
{
public MSession() { }

public MSession(string? username, string? accesstoken, string? uuid)
public MSession(string? username, string? accessToken, string? uuid)
{
Username = username;
AccessToken = accesstoken;
AccessToken = accessToken;
UUID = uuid;
}

Expand All @@ -21,6 +21,8 @@ public MSession(string? username, string? accesstoken, string? uuid)
public string? UUID { get; set; }
[JsonProperty("clientToken")]
public string? ClientToken { get; set; }

public string? UserType { get; set; }

public bool CheckIsValid()
{
Expand All @@ -35,7 +37,8 @@ public static MSession GetOfflineSession(string username)
{
Username = username,
AccessToken = "access_token",
UUID = "user_uuid",
UUID = "user_uuid",
UserType = "Mojang",
ClientToken = null
};
}
Expand Down
2 changes: 1 addition & 1 deletion CmlLib/Core/Launcher/MLaunch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public string[] CreateArg()
{ "auth_uuid" , session.UUID },
{ "auth_access_token", session.AccessToken },
{ "user_properties" , "{}" },
{ "user_type" , "Mojang" },
{ "user_type" , session.UserType ?? "Mojang" },
{ "game_assets" , minecraftPath.GetAssetLegacyPath(version.AssetId ?? "legacy") },
{ "auth_session" , session.AccessToken },
{ "version_type" , useNotNull(LaunchOption.VersionType, version.TypeStr) }
Expand Down

0 comments on commit 45b0b3c

Please sign in to comment.