From 09bd0164ebc020a54b944b7326dcba496fb5d82c Mon Sep 17 00:00:00 2001
From: Minteck <contact@minteck.org>
Date: Fri, 26 Aug 2022 22:29:23 +0200
Subject: idk when was the last commit so I'm making a new one - Violet Dawn

---
 Authentication/Callback/index.php | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

(limited to 'Authentication/Callback')

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, [
-- 
cgit