I'm trying to revoke a token in php using this lib but I keep getting a false after calling handleRevokeRequest I'm struggling to find working example on the web
public function revokeToken($token, $sendError = true, $method = null)
{
require_once dirname(__FILE__) . '/vendor/autoload.php';
require_once dirname(__FILE__) . '/OAuthStorage.class.php';
OAuth2\Autoloader::register();
$storage = new OAuth2\Storage\OvidentiaOAuthStorage();
$server = new OAuth2\Server($storage);
// Add the 'Authorization Code' grant type (this is where the oauth magic happens)
$server->addGrantType(new OAuth2\GrantType\AuthorizationCode($storage));
if ($method == null) {
$method = $_SERVER['REQUEST_METHOD'];
}
$request = new OAuth2\Request(array(), array('token' => $token), array(), array(), array(), array('REQUEST_METHOD' => $method));
if (!$server->handleRevokeRequest($request)) {
if ($sendError === true) {
$server->getResponse()->send();
die;
} else {
$this->errorMessages = array();
$error = $server->getResponse()->getParameters();
if (isset($error['error_description'])) {
var_dump($error['error_description']);
$this->errorMessages[] = $error['error_description'];
}
return false;
}
} else {
var_dump("else");
}
return true;
}
I'm trying to revoke a token in php using this lib but I keep getting a false after calling handleRevokeRequest I'm struggling to find working example on the web