I have working with Google OpenId API for my website. I need to implement the Force Logout Concept with Google OpenId API.
Below code i have tried, but I can't get the actual solution for force logout with openId.
How do I logout the Current Login Session in 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>");
}
}
?>