Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
EvanEvan-17 opened this issue Oct 5, 2022 · 0 comments

Comments

@EvanEvan-17
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant