protected function requestAccessToken() {
        $code = $this->getRequestVar('code');
        if (!empty($code)) {
            $res = $this->sendRequest('POST', $this->getUrl('oauth', 'token'), array(
                'code' => $code,
                'client_id' => $this->getClientId(),
                'client_secret' => $this->getClientSecret(),
                'grant_type' => 'authorization_code',
                'redirect_uri' => $this->redirectUri,
            ));
            $result = $res->getBody();
            if ($result && $result = json_decode($result, true)) {
                if (!empty($result['error'])) {
                    throw new Exception($result['error_description']);
                }

                return $result;
            }
        }
        return null;
    }