From 8ed0f1941f2c6123f624ff2970a4b3e84c1504a9 Mon Sep 17 00:00:00 2001 From: "rijuthm@gmail.com" Date: Thu, 3 Jun 2021 20:34:19 +0530 Subject: [PATCH] added connections scope as example --- demo/config.php | 2 +- demo/includes/discord.php | 2 +- demo/includes/login.php | 4 ++-- demo/index.php | 44 +++++++++++++++++++++------------------ 4 files changed, 28 insertions(+), 24 deletions(-) diff --git a/demo/config.php b/demo/config.php index 2ff7d16..249f1f0 100644 --- a/demo/config.php +++ b/demo/config.php @@ -8,7 +8,7 @@ $secret_id = ""; # SCOPES SEPARATED BY SPACE -# example: identify email guilds +# example: identify email guilds connections $scopes = ""; # REDIRECT URL diff --git a/demo/includes/discord.php b/demo/includes/discord.php index fe804c5..3631b0b 100644 --- a/demo/includes/discord.php +++ b/demo/includes/discord.php @@ -112,7 +112,7 @@ function get_guild($id) function get_connections() { $url = $GLOBALS['base_url'] . "/api/users/@me/connections"; - $headers = array ('Content-Type: application/x-www-form-urlencoded', 'Authorization: Bearer ' . $_SESSION['access_token']); + $headers = array('Content-Type: application/x-www-form-urlencoded', 'Authorization: Bearer ' . $_SESSION['access_token']); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); diff --git a/demo/includes/login.php b/demo/includes/login.php index a01bf95..f8b1fc4 100644 --- a/demo/includes/login.php +++ b/demo/includes/login.php @@ -41,7 +41,7 @@ $_SESSION['guilds'] = get_guilds(); # Fetching user connections | (connections scope) -# $_SESSION['connections'] = get_connections(); - +$_SESSION['connections'] = get_connections(); + # Redirecting to home page once all data has been fetched redirect("../index.php"); diff --git a/demo/index.php b/demo/index.php index 8319c46..ad43683 100644 --- a/demo/index.php +++ b/demo/index.php @@ -84,29 +84,33 @@ ?>
-

User Guilds Response :

-

-
-

User Connections :

+

User Guilds Response :

+
+

+
+
+

User Connections :

- - - - - "; - echo ""; - } - ?> + + + + + "; + echo ""; + } + ?>
NAMEID
"; - echo $_SESSION['connections'][$i]['name']; - echo ""; - echo $_SESSION['connections'][$i]['type']; - echo "
NAMETYPE
"; + echo $_SESSION['connections'][$i]['name']; + echo ""; + echo $_SESSION['connections'][$i]['type']; + echo "

-

User Connections Response :

-

+

User Connections Response :

+
+

+
\ No newline at end of file