Skip to content

Failed to re-write Device Token generation function in PHP & Laravel #4

Description

@EvanEvan-17

I'm trying to rewrite Device Token generation function in PHP & Laravel from this library, but it failed. Can you please check my code, what's wrong with it?

$serviceProofKey = [
            'crv' => 'P-256',
            'alg' => 'ES256',
            'use' => 'sig',
            'kty' => 'EC',
            'x' => 'b8Zc6GPFeu41DqiWPJxRa_jqUTSiMA537emKVHt8UO8',
            'y' => 'CXAuTEHet72GjgSDfDg6psBrwE1waxBsNEIGrRZV_90'
        ];
        $response = Http::withHeaders([
            'Signature' => 'AAAAAQHW6oD31MwA6MAjn67vdCppWCbrMovubA85xejO06rtOAEdZ0tMTZFnu7xbI6lZDNvIWfuMaIPJSUcpvxjKqSFJl1oaWzQGBw=='
        ])->withUserAgent('XboxReplay; XboxLiveAuth/4.0')->post('https://device.auth.xboxlive.com/device/authenticate', [
            'RelyingParty' => 'http://auth.xboxlive.com',
            'TokenType' => 'JWT',
            'Properties' => [
                'AuthMethod' => 'ProofOfPossession',
                'TrustedParty' => 'https://xboxreplay.net/',
                'Id' => '{21354D2F-352F-472F-5842-5265706C6179}',
                'DeviceType' => 'Win32',
                'Version' => '10.0.18363',
                'ProofKey' => $serviceProofKey
            ]
        ]);
        dd($response->json());

The Http class is a Laravel class that used to call the API.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions