From 50b7b70a58942474790ac9c65ac58af87e90abb8 Mon Sep 17 00:00:00 2001 From: Minteck Date: Wed, 13 Apr 2022 09:13:01 +0200 Subject: Attempt 1 at fixing broken session --- oauth/embed/index.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'oauth/embed') diff --git a/oauth/embed/index.php b/oauth/embed/index.php index ff47ef0..663d5bc 100644 --- a/oauth/embed/index.php +++ b/oauth/embed/index.php @@ -10,7 +10,7 @@ if (!isset($_GET['code'])) { $appdata = json_decode(file_get_contents("/mnt/familine/private/app.json"), true); -$crl = curl_init('https://' . $_CONFIG["Global"]["federation"]. '/auth/realms/Familine/protocol/openid-connect/token'); +$crl = curl_init('https://' . $_CONFIG["Global"]["federation"]. '/hub/api/rest/oauth2/token'); curl_setopt($crl, CURLOPT_RETURNTRANSFER, true); curl_setopt($crl, CURLINFO_HEADER_OUT, true); curl_setopt($crl, CURLOPT_POST, true); @@ -19,8 +19,9 @@ curl_setopt($crl, CURLOPT_HTTPHEADER, [ "Content-Type: application/x-www-form-urlencoded", "Accept: application/json" ]); -curl_setopt($crl, CURLOPT_POSTFIELDS, "grant_type=authorization_code&redirect_uri=" . urlencode("https://session." . $_CONFIG["Global"]["domain"] . "/oauth/embed") . "&code=" . $_GET['code']); +curl_setopt($crl, CURLOPT_POSTFIELDS, "grant_type=authorization_code&redirect_uri=" . urlencode("https://session." . $_CONFIG["Global"]["domain"] . "/oauth/?r=" . $_GET['r']) . "&code=" . $_GET['code']); +var_dump("grant_type=authorization_code&redirect_uri=" . urlencode("https://" . $_CONFIG["Global"]["domain"] . "/oauth/?r=" . $_GET['r']) . "&code=" . $_GET['code']); $result = curl_exec($crl); var_dump($result); $result = json_decode($result, true); @@ -28,7 +29,7 @@ $result = json_decode($result, true); curl_close($crl); if (isset($result["access_token"])) { - $crl = curl_init('https://' . $_CONFIG["Global"]["federation"]. '/auth/realms/Familine/protocol/openid-connect/userinfo'); + $crl = curl_init('https://' . $_CONFIG["Global"]["federation"]. '/hub/api/rest/users/me'); curl_setopt($crl, CURLOPT_RETURNTRANSFER, true); curl_setopt($crl, CURLINFO_HEADER_OUT, true); curl_setopt($crl, CURLOPT_HTTPHEADER, [ -- cgit