Problems with Logout Google Api - PHP

0

I have trouble logging out with google social login. I defined a config_google.php file, this being the one:

$googleClient = new \Google_Client(); 
$googleClient->setClientId("1001242887386-2gc1fg95kro8gpo9hrbg7a06iv6hh9iu.apps.googleusercontent.com"); 
$googleClient-setClientSecret("bYeOkLGsHV1rtwJfwOlg3hZC"); 
$googleClient-setApplicationName("askmm-homologacao"); 
$googleClient-setRedirectUri("http://localhost:8000/login/google"); 
$googleClient-addScope("https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email");

In my callback url I defined the following method:

$token = $googleClient->fetchAccessTokenWithAuthCode( $_GET['code'] );
$_SESSION['access_token'] = $token;

$oAuth = new \Google_Service_Oauth2($googleClient);
$userDataGoogle = $oAuth->userinfo_v2_me->get();

And to execute the logout, the following method:

    $googleClient->revokeToken();
    unset( $_SESSION );
    session_destroy();
    header("Location: /login");

I quit the application, but when I click again on google login, it goes in automatically, not asking for google email and password. It is curly, but I need to log in to the app once again request email and password.

    
asked by anonymous 20.07.2018 / 04:52

0 answers