1. Go to this page and download the library: Download julesr2/jwt-verifier 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/ */
julesr2 / jwt-verifier example snippets
$jwtVerifier = (new \Okta\JwtVerifier\JwtVerifierBuilder())
->setDiscovery(new \Okta\JwtVerifier\Discovery\Oauth) // This is not needed if using oauth. The other option is `new \Okta\JwtVerifier\Discovery\OIDC`
->setAdaptor(new \Okta\JwtVerifier\Adaptors\FirebasePhpJwt)
->setAudience('api://default')
->setClientId('{clientId}')
->setIssuer('https://{yourOktaDomain}.com/oauth2/default')
->build();
dump($jwt); //Returns instance of \Okta\JwtVerifier\JWT
dump($jwt->toJson()); // Returns Claims as JSON Object
dump($jwt->getClaims()); // Returns Claims as they come from the JWT Package used
dump($jwt->getIssuedAt()); // returns Carbon instance of issued at time
dump($jwt->getIssuedAt(false)); // returns timestamp of issued at time
dump($jwt->getExpirationTime()); //returns Carbon instance of Expiration Time
dump($jwt->getExpirationTime(false)); //returns timestamp of Expiration Time
$jwt = $jwtVerifier->verifyIdToken($jwtString);
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.