From be5c4b753ad5ac0a2dd5940ffe3cbb44e91a6812 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 17 Jan 2025 19:40:33 +0000 Subject: [PATCH] fix: syntax --- src/Appwrite/Auth/OAuth2/Slack.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Appwrite/Auth/OAuth2/Slack.php b/src/Appwrite/Auth/OAuth2/Slack.php index 88d5b6a3a4..dd35a590b1 100644 --- a/src/Appwrite/Auth/OAuth2/Slack.php +++ b/src/Appwrite/Auth/OAuth2/Slack.php @@ -32,11 +32,12 @@ class Slack extends OAuth2 } /** + * @link https://api.slack.com/authentication/oauth-v2 + * * @return string */ public function getLoginURL(): string { - // https://api.slack.com/authentication/oauth-v2 return 'https://slack.com/oauth/v2/authorize?' . \http_build_query([ 'client_id' => $this->appID, 'user_scope' => \implode(',', $this->getScopes()), @@ -82,7 +83,7 @@ class Slack extends OAuth2 'refresh_token' => $refreshToken, 'grant_type' => 'refresh_token' ]) - ), true); + ), true)['authed_user']; if (empty($this->tokens['refresh_token'])) { $this->tokens['refresh_token'] = $refreshToken; @@ -158,13 +159,8 @@ class Slack extends OAuth2 $user = $this->request( 'GET', 'https://slack.com/api/users.identity', - [ - 'headers' => [ - 'Authorization' => 'Bearer ' . $accessToken - ] - ] + ['Authorization: Bearer ' . \urlencode($accessToken)] ); - $this->user = \json_decode($user, true); }