-
Notifications
You must be signed in to change notification settings - Fork 1
/
auth.php
executable file
·31 lines (25 loc) · 764 Bytes
/
auth.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/php
<?php
define("AUTHCACHE", "/tmp/auth_info");
define("XUIDCACHE", "/tmp/xuid");
define("EXPIRES", "/tmp/session_expires");
require_once 'XboxLiveClient.php';
$shortopts = "";
$shortopts .= "u:";
$shortopts .= "p:";
$options = getopt($shortopts);
$username = $options['u'];
$password = $options['p'];
if (file_exists(AUTHCACHE) && file_exists(XUIDCACHE)) {
unlink(AUTHCACHE);
unlink(XUIDCACHE);
}
try {
$live = XboxLiveClient::withUsernameAndPassword($username, $password);
}
catch (Exception $e) {
printf("Couldn't go with u/p with message '%s'\n", $e->getMessage());
exit;
}
file_put_contents(XUIDCACHE, $live->xuid);
file_put_contents(AUTHCACHE, $live->authorization_header);