trOnGAtE

Destroying Tokens (JavaScript Friendly Version)
The 'Destroy Token' API Endpoint
Trongate apps contain an API endpoint that can be used to destroy tokens via HTTP DELETE (or POST) requests. The URL for destroying tokens is your base URL followed by trongate_tokens/destroy.
function destroy() {
die(); //disable this endpoint!​
if (!isset($_SERVER['HTTP_TRONGATETOKEN'])) {
http_response_code(422);
echo 'No token found in here!';
die();
} else {
$params['token'] = $_SERVER['HTTP_TRONGATETOKEN'];
$sql = 'delete from trongate_tokens where token = :token';
$this->model->query_bind($sql, $params);
http_response_code(200);
echo 'Token deleted.';
die();
}
}
Adding Your Token To The Header
To use Trongate's token management system in a stateless environment, you'll have to attach a valid token onto the header of your HTTP requests.
In vanilla JavaScript this can be achieved with the following code:
setRequestHeader("trongateToken",token)
The screenshot below show an example of Trongate's API Manager being used to successfully destroy a token that has been attached to the header of an HTTP request. As you can see (near the top right hand side) the server has responded with a '200' status code.

HELP & SUPPORT
If you have a question or a comment relating to anything you've see here, please goto the Help Bar.