summaryrefslogtreecommitdiff
path: root/Authentication/Callback/index.php
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-08-26 22:29:23 +0200
committerMinteck <contact@minteck.org>2022-08-26 22:29:23 +0200
commit09bd0164ebc020a54b944b7326dcba496fb5d82c (patch)
tree0c5e765e627ecc94e534ccb6e2bc83917d58dc4c /Authentication/Callback/index.php
parenta2df9a69dcc14cb70118cda2ded499055e7ee358 (diff)
downloadpluralconnect-09bd0164ebc020a54b944b7326dcba496fb5d82c.tar.gz
pluralconnect-09bd0164ebc020a54b944b7326dcba496fb5d82c.tar.bz2
pluralconnect-09bd0164ebc020a54b944b7326dcba496fb5d82c.zip
idk when was the last commit so I'm making a new one - Violet Dawn
Diffstat (limited to 'Authentication/Callback/index.php')
-rw-r--r--Authentication/Callback/index.php9
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, [