THAPA TECHNICAL

HOUSE OF WEB DEVELOPERS AND TECHNOLOGY.

Logout.php page code for Google OAuth Login in PHP

Logout.php page code for Google OAuth Login in PHP

<?php

//logout.php

include('config.php');

//Reset OAuth access token
$google_client->revokeToken();

//Destroy entire session data.
session_destroy();

//redirect page to index.php
header('location:index.php');

?>

3 comments:


  1. Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error: `POST https://oauth2.googleapis.com/revoke` resulted in a `400 Bad Request` response: { "error": "invalid_request", "error_description": "Bad Request" } in C:\xampp\htdocs\gopala\gopala_fastion\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php:111 Stack trace: #0 C:\xampp\htdocs\gopala\gopala_fastion\vendor\guzzlehttp\guzzle\src\Middleware.php(66): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response)) #1 C:\xampp\htdocs\gopala\gopala_fastion\vendor\guzzlehttp\promises\src\Promise.php(203): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response)) #2 C:\xampp\htdocs\gopala\gopala_fastion\vendor\guzzlehttp\promises\src\Promise.php(156): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), Array) #3 C:\xampp\htdocs\gopala\gopala_fastion\vendor\guzzlehttp\promises\src\TaskQueue.php(47): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{clo in C:\xampp\htdocs\gopala\gopala_fastion\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php on line 111

    ReplyDelete

  2. Fatal error: Uncaught GuzzleHttp\Exception\RequestException: cURL error 77: error setting certificate verify locations: CAfile: C:\xampp\apache\bin\curl-ca-bundle.crt CApath: none (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) in C:\xampp\htdocs\login\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:208 Stack trace: #0 C:\xampp\htdocs\login\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(162): GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle), Array) #1 C:\xampp\htdocs\login\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(109): GuzzleHttp\Handler\CurlFactory::finishError(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory)) #2 C:\xampp\htdocs\login\vendor\guzzlehttp\guzzle\src\Handler\CurlHandler.php(45): GuzzleHttp\Handler\CurlFactory::finish(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory)) #3 C:\xampp\htdocs\login\vendor\guz in C:\xampp\htdocs\login\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 208

    ReplyDelete
    Replies
    1. just remove $google_client->revokeToken();

      Delete