示例#1
0
/**
 * Событие на возникновение ошибки OAuth2Exception
 * @param \OAuth2Exception $e
 */
function onOAuth2Exception($e)
{
    //Ваш код здесь
    onException($e);
}
示例#2
0
            if (onUserAuthorized) {
                debug('Event onUserAuthorized');
                onUserAuthorized($user);
            }
            header("Location: " . TRUSTED_AUTHORIZED_REDIRECT);
        } else {
            include_once "./widget.tpl";
        }
    } else {
        $token = OAuth2::getFromSession();
        if (!$token) {
            throw new OAuth2Exception(TRUSTEDNET_ERROR_MSG_TOKEN_NOT_FOUND, TRUSTEDNET_ERROR_CODE_TOKEN_NOT_FOUND, null);
        }
        $token->getAccessToken();
        $token->getUser();
        debug("Token", $token);
    }
} catch (OAuth2Exception $e) {
    if (onOAuth2Exception) {
        onOAuth2Exception($e);
    }
    debug("OAuth2Exception: " . $e->getMessage());
    debug($e->getTrace());
} catch (Exception $e) {
    if (Exception) {
        onException($e);
    }
    debug("Exception: " . $e->getMessage());
    debug($e->getTrace());
}
debug("END");