私は自分のウェブサイトで Google OpenId API を使用しています。Google OpenId API を使用して強制ログアウトの概念を実装する必要があります。
以下のコードを試しましたが、openId を使用した強制ログアウトの実際の解決策を得ることができません。
Google OpenId で現在のログイン セッションをログアウトするにはどうすればよいですか?
<?php
session_start();
if (isset($_SESSION['id']))
{
// Redirection to login page.
header("location: home.php");
}
if (array_key_exists("login", $_GET)) {
$oauth_provider = $_GET['oauth_provider'];
if ($oauth_provider == 'google') {
$url='https://www.google.com/accounts/Logout';
//After clearing a session it is redirected to login-google.php
$redirectUrl="login-google.php";
$redirectUrl = '&return='.$redirectUrl;
$finalUrl = $url . $redirectUrl;
echo("<script>top.location.href='".$finalUrl."'</script>");
}
}
?>