1. Go to this page and download the library: Download hungdx/auth-token library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
return [
'lifetime' => [
'expired' => 7 * 24 * 3600, // Lifetime of token before expired. Default 7 days
'refresh' => 3600, // The minimum seconds before changing the token. Default 1 hour
],
'token_field' => [
'header' => 'Authorization', // Set [false/null/empty] to disable send token to response header
'cookie' => 'X-Auth-Token', // Set [false/null/empty] to disable send token to response cookie
],
'autoload_middleware' => true, // Auto add to middleware HungDX\AuthToken\AuthTokenMiddleware to every request
];