Categories
Uncategorized

Generate/Check valid JWTs using PHP

jwt

https://github.com/Shiva1029/token

Pull the latest code from the repository onto your web server with php 5.x+ pre-installed.

  1. Run index.php first to generate a JWT (JSON Web Token) token.
  2. Paste the JWT into the variable $jwt in check_token.php within 5 mins after generating it, to validate the JWT. The JWT expiration time is set to until 300 seconds after 10 initial seconds delay. If the JWT is validated after this time period, then you will get an error that states that the token is invalid as it is expired.
  3. The server side secret key can be regenerated using genSecret.php
    This value can be used  to replace the existing secret key in the config/config.php file.

This code uses the following composer libraries:
{
“require”: {
“firebase/php-jwt”: “dev-master”,
“zendframework/zend-config”: “~2.3”,
“zendframework/zend-http”: “~2.3”
}
}