private function handleTokenResponse($response)
    {
        $params = ($response instanceof OAuthToken) ? $response->getParams() : $response;
        $status = ArrayHelper::getValue($params, 'status');
        if (!is_null($status) && $status == 'success') {
            $token = ArrayHelper::getValue($params, 'data');
            if (is_null($token)) {
                throw new Oauth2ClientException(self::CODE_NOT_SET);
            }
            return $token;
        } else {
            $message = ArrayHelper::getValue($params, 'message', self::DEFAULT_ERROR);
            throw new Oauth2ClientException($message);
        }
    }