本文整理汇总了PHP中MainController::getAccessToken方法的典型用法代码示例。如果您正苦于以下问题:PHP MainController::getAccessToken方法的具体用法?PHP MainController::getAccessToken怎么用?PHP MainController::getAccessToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainController
的用法示例。
在下文中一共展示了MainController::getAccessToken方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
}
if (!is_string($config['redirect_uri']) || !filter_var($config['redirect_uri'], FILTER_VALIDATE_URL)) {
ob_end_clean();
header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error (invalid redirect_uri)');
die('Bad config: redirect_uri');
}
if (!is_string($config['admin_redirect_uri']) || !filter_var($config['admin_redirect_uri'], FILTER_VALIDATE_URL)) {
ob_end_clean();
header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error (invalid admin_redirect_uri)');
die('Bad config: admin_redirect_uri');
}
try {
$main = new MainController($_REQUEST, $config['client_id'], $config['client_secret'], $config['redirect_uri'], $config['admin_redirect_uri'], isset($_SESSION['access_token']) ? $_SESSION['access_token'] : null, $startTime, null, null, null, null, null, isset($_SESSION['webapp']) ? $_SESSION['webapp'] : false, $debug);
$out = $main->process();
// on token expiration/revocation/refreshing this should reset the token
$_SESSION['access_token'] = $main->getAccessToken();
if (isset($out['loginSuccess']) && $out['loginSuccess'] && isset($_SESSION['webapp']) && $_SESSION['webapp']) {
header('Location: webapp/index.php');
exit;
}
if (isset($out['logoutSuccess']) && $out['logoutSuccess'] && isset($_SESSION['webapp']) && $_SESSION['webapp']) {
header('Location: main.php?collection=user&action=login');
exit;
}
if (isset($out['html'])) {
echo $out['html'];
} else {
echo json_encode($out);
}
} catch (Exception $e) {
// on token expiration/revocation/refreshing this should reset the token