Corona-Studio / ProjBobcat

The next generation Minecraft launcher core written in C# providing the freest, fastest and the most complete experience.
https://kb.corona.studio/zhCN/projbobcat/
MIT License
159 stars 21 forks source link

[BUG] Yggdrasil cannot log in, login failed #91

Closed imJack6 closed 1 year ago

imJack6 commented 1 year ago

Describe the bug When I use the skin station and need to use the YggdrasilAuthenticator authenticator, when executing var authResult = await yggdrasilAuthenticator.AuthTaskAsync();, result.User is Null, resulting in Object reference not set to an instance of an object , the first exception occurs at ProjBobcat\DefaultComponent\Authenticator\YggdrasilAuthenticator.cs:line 176

ProjBobcat Version The latest Master branch of the repository

To Reproduce Steps to reproduce the behavior:

  1. Initialize the Authenticator
            var yggdrasilAuthenticator = new YggdrasilAuthenticator
            {
                AuthServer = [AuthServer],
                Email = [Email],
                LauncherAccountParser = ...,
                Password = [Password]
            };
  2. Use var authResult = await yggdrasilAuthenticator.AuthTaskAsync(); to authenticate.
  3. Go to ProjBobcat\DefaultComponent\Authenticator\YggdrasilAuthenticator.cs:line 176 to see the error.

Expected behavior Can login

Screenshots image

Desktop (please complete the following information):

Additional context When I checked the source code, I found that the result.User at

        var profile = new AccountModel
        {
            AccessToken = result.AccessToken,
            AccessTokenExpiresAt = DateTime.Now.AddHours(48),
            EligibleForMigration = false,
            HasMultipleProfiles = profiles.Count > 1,
            Legacy = false,
            LocalId = rUuid,
            Persistent = true,
            RemoteId = result.User.UUID.ToString(),
            Type = "Mojang",
            UserProperites = result.User?.Properties?.ToAuthProperties(profiles).ToArray() ??
                             Array.Empty<AuthPropertyModel>(),
            Username = Email
        };

was Null and caused an exception to be thrown.

laolarou726 commented 1 year ago

fixed