public function processAuthResponse($response)
    {
        if (!$this->isArray($response)) {
            throw new OAuth2Exception('Invalid response while trying to get the access token.');
        }

        if (isset($response['result']['error'])) {
            throw new OAuth2Exception($this->jsonEncode($response['result']['error']['message']));
        }

        parse_str($response['result'], $info);

        return $info['access_token'];
    }