【发布时间】:2014-06-17 18:52:00
【问题描述】:
看看这个google client api for php example
我注意到这部分代码:
/************************************************
If we have a code back from the OAuth 2.0 flow,
we need to exchange that with the authenticate()
function. We store the resultant access token
bundle in the session, and redirect to ourself.
************************************************/
if (isset($_GET['code'])) {
$client->authenticate($_GET['code']);
$_SESSION['access_token'] = $client->getAccessToken();
$redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL));
}
问题是我没有收到重定向 (header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL));)。事实上,你可以删除它,一切似乎都很好。那么,为什么会出现呢?
【问题讨论】:
标签: php oauth-2.0 google-oauth claims-based-identity google-api-php-client