diff --git a/app/config/providers.php b/app/config/providers.php index 1d364a3fcf..c0acceb0fc 100644 --- a/app/config/providers.php +++ b/app/config/providers.php @@ -241,16 +241,6 @@ return [ // Ordered by ABC. 'beta' => false, 'mock' => false, ], - 'vk' => [ - 'name' => 'VK', - 'developers' => 'https://vk.com/dev', - 'icon' => 'icon-vk', - 'enabled' => true, - 'sandbox' => false, - 'form' => false, - 'beta' => false, - 'mock' => false, - ], 'zoom' => [ 'name' => 'Zoom', 'developers' => 'https://marketplace.zoom.us/docs/guides/auth/oauth/', diff --git a/public/images/users/vk.png b/public/images/users/vk.png deleted file mode 100644 index e3cf2d74ef..0000000000 Binary files a/public/images/users/vk.png and /dev/null differ diff --git a/src/Appwrite/Auth/OAuth2/Bitbucket.php b/src/Appwrite/Auth/OAuth2/Bitbucket.php index 4c089b36c7..36d55fc3ce 100644 --- a/src/Appwrite/Auth/OAuth2/Bitbucket.php +++ b/src/Appwrite/Auth/OAuth2/Bitbucket.php @@ -179,7 +179,7 @@ class Bitbucket extends OAuth2 $emails = \json_decode($emails, true); if (isset($emails['values'])) { foreach ($emails['values'] as $email) { - if ($email['is_primary']) { + if ($email['is_confirmed']) { $this->user['email'] = $email['email']; $this->user['is_confirmed'] = $email['is_confirmed']; break; diff --git a/src/Appwrite/Auth/OAuth2/Vk.php b/src/Appwrite/Auth/OAuth2/Vk.php deleted file mode 100644 index fefd2f7862..0000000000 --- a/src/Appwrite/Auth/OAuth2/Vk.php +++ /dev/null @@ -1,203 +0,0 @@ - $this->appID, - 'redirect_uri' => $this->callback, - 'response_type' => 'code', - 'state' => \json_encode($this->state), - 'v' => $this->version, - 'scope' => \implode(' ', $this->getScopes()) - ]); - } - - /** - * @param string $code - * - * @return array - */ - protected function getTokens(string $code): array - { - if(empty($this->tokens)) { - $headers = ['Content-Type: application/x-www-form-urlencoded;charset=UTF-8']; - $this->tokens = \json_decode($this->request( - 'POST', - 'https://oauth.vk.com/access_token?', - $headers, - \http_build_query([ - 'code' => $code, - 'client_id' => $this->appID, - 'client_secret' => $this->appSecret, - 'redirect_uri' => $this->callback - ]) - ), true); - - $this->user['email'] = $this->tokens['email']; - $this->user['user_id'] = $this->tokens['user_id']; - } - - return $this->tokens; - } - - /** - * @param string $refreshToken - * - * @return array - */ - public function refreshTokens(string $refreshToken):array - { - $headers = ['Content-Type: application/x-www-form-urlencoded;charset=UTF-8']; - $this->tokens = \json_decode($this->request( - 'POST', - 'https://oauth.vk.com/access_token?', - $headers, - \http_build_query([ - 'refresh_token' => $refreshToken, - 'client_id' => $this->appID, - 'client_secret' => $this->appSecret, - 'grant_type' => 'refresh_token' - ]) - ), true); - - if(empty($this->tokens['refresh_token'])) { - $this->tokens['refresh_token'] = $refreshToken; - } - - $this->user['email'] = $this->tokens['email']; - $this->user['user_id'] = $this->tokens['user_id']; - - return $this->tokens; - } - - /** - * @param string $accessToken - * - * @return string - */ - public function getUserID(string $accessToken): string - { - $user = $this->getUser($accessToken); - - if (isset($user['user_id'])) { - return $user['user_id']; - } - - return ''; - } - - /** - * @param string $accessToken - * - * @return string - */ - public function getUserEmail(string $accessToken): string - { - $user = $this->getUser($accessToken); - - if (isset($user['email'])) { - return $user['email']; - } - - return ''; - } - - /** - * Check if the OAuth email is verified - * - * @param $accessToken - * - * @return bool - */ - public function isEmailVerified(string $accessToken): bool - { - return false; - } - - /** - * @param string $accessToken - * - * @return string - */ - public function getUserName(string $accessToken): string - { - $user = $this->getUser($accessToken); - - if (isset($user['name'])) { - return $user['name']; - } - - return ''; - } - - /** - * @param string $accessToken - * - * @return array - */ - protected function getUser(string $accessToken): array - { - if (empty($this->user['name'])) { - $user = $this->request( - 'GET', - 'https://api.vk.com/method/users.get?'. \http_build_query([ - 'v' => $this->version, - 'fields' => 'id,name,email,first_name,last_name', - 'access_token' => $accessToken - ]) - ); - - $user = \json_decode($user, true); - $this->user['name'] = $user['response'][0]['first_name'] ." ".$user['response'][0]['last_name']; - } - return $this->user; - } -} diff --git a/src/Appwrite/Auth/OAuth2/Yammer.php b/src/Appwrite/Auth/OAuth2/Yammer.php index a50975c82e..9ec9b56eea 100644 --- a/src/Appwrite/Auth/OAuth2/Yammer.php +++ b/src/Appwrite/Auth/OAuth2/Yammer.php @@ -133,7 +133,7 @@ class Yammer extends OAuth2 /** * Check if the OAuth email is verified * - * If present, the email is verified. + * If present, the email is verified. This was verfied through a manual Yammer sign up process * * @param $accessToken *