1. Go to this page and download the library: Download luk-z/php-api-token-auth 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/ */
luk-z / php-api-token-auth example snippets
[
"result" => true,
"data" => ["sid" => string] // user session id
]
[
"result" => false,
"error" => [
"message" => string,
"code" => string,
],
"secondsLeft" => int // only if a valid token is already present, indicates the remaining seconds till token expiration
]
[
"result" => true,
"data" => [
"queryResult" => boolean, // whether the user password is modified correctly
"currentTokenDeleted" => int, // result of deleting current change password token (should be always 1)
"accessTokenDeleted" => int, // number of access token deleted
"refreshTokenDeleted" => int, // number of refresh token deleted
"email" => int, // email of the current user
"userId" => int, // id of the current user
]
]