Trongate Website Homepage

Destroying Tokens

In certain scenarios, such as when a user logs out of a private members' area, it may be necessary to delete a token from the user's device and from your application's database. This can be accomplished by invoking the _destroy() method from the Trongate Tokens module. This method does not require any arguments.

Below is an example of how to invoke the destroy method:


$this->module('trongate_tokens');
$this->trongate_tokens->_destroy();
    

This method clears any tokens that might be stored as either session data or cookie data on the user's device. If a token is found, the method will also delete corresponding records from the 'trongate_tokens' table.

If the _destroy() method is invoked when the end user does not have a valid token, nothing will happen, and no error messages will be produced.