diff options
Diffstat (limited to 'Authentication/Callback')
-rw-r--r-- | Authentication/Callback/index.php | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Authentication/Callback/index.php b/Authentication/Callback/index.php index 6a6d8f1..b68000b 100644 --- a/Authentication/Callback/index.php +++ b/Authentication/Callback/index.php @@ -1,5 +1,8 @@ <?php +$channel = "private"; +$server = "privateauth.equestria.dev"; + header("Content-Type: text/plain"); // TODO: handle errors @@ -7,9 +10,9 @@ if (!isset($_GET['code'])) { die(); } -$appdata = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); +$appdata = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)[$channel]; -$crl = curl_init('https://privateauth.equestria.dev/hub/api/rest/oauth2/token'); +$crl = curl_init('https://' . $server . '/hub/api/rest/oauth2/token'); curl_setopt($crl, CURLOPT_RETURNTRANSFER, true); curl_setopt($crl, CURLINFO_HEADER_OUT, true); curl_setopt($crl, CURLOPT_POST, true); @@ -26,7 +29,7 @@ $result = json_decode($result, true); curl_close($crl); if (isset($result["access_token"])) { - $crl = curl_init('https://privateauth.equestria.dev/hub/api/rest/users/me'); + $crl = curl_init('https://' . $server . '/hub/api/rest/users/me'); curl_setopt($crl, CURLOPT_RETURNTRANSFER, true); curl_setopt($crl, CURLINFO_HEADER_OUT, true); curl_setopt($crl, CURLOPT_HTTPHEADER, [ |