Skip to content

正版验证出现错误 #239

@water2004

Description

@water2004

完成微软账户登录后发生服务器错误:Undefined array key "access_token"

对应的URL是:https:///mojang/callback?code=&state=***

debug模式下显示的对应代码位置

        // Authenticate with Minecraft

        $response = Http::post('https://api.minecraftservices.com/authentication/login_with_xbox', [

            'identityToken' => 'XBL3.0 x='.$user_hash.';'.$xsts_token,

        ])->json();

 

        if (Arr::exists($response, 'error')) {

            // UNAUTHORIZED

            Log::channel('mojang-verification')->info("User [$user->email] authenticate with Minecraft failed.", compact('response'));

            abort(500);

        }

 

        => $minecraft_access_token = $response['access_token'];

 

        // Get the profile

        $response = Http::withToken($minecraft_access_token)->get('https://api.minecraftservices.com/minecraft/profile')->json();

 

        if (Arr::exists($response, 'error')) {

            // logger($response);

            // NOT_FOUND

            // CONSTRAINT_VIOLATION

            Log::channel('mojang-verification')->info("User [$user->email] get the profile failed.", compact('response'));

            abort(403, trans('GPlane\Mojang::bind.failed.not-purchased'));

        }

 

        return $response;

    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions