|
| 1 | +<?php |
| 2 | +// https://github.com/BaseMax/php-jwt-example |
| 3 | +require 'vendor/autoload.php'; |
| 4 | +use \Firebase\JWT\JWT; |
| 5 | +use \Firebase\JWT\SignatureInvalidException; |
| 6 | +$key = '83aeee518617ad6f3393bf0685e37d3e'; |
| 7 | + |
| 8 | +$headers=getallheaders(); |
| 9 | +// LOG: print_r($headers); |
| 10 | +if(!isset($headers["Authorization"])) { |
| 11 | + exit("No 'Authorization' header!\n"); |
| 12 | +} |
| 13 | + |
| 14 | +$token = $headers["Authorization"]; |
| 15 | +$token = str_replace("Bearer ", "", $token); // or remove 'Bearer ' from first of letters! |
| 16 | + |
| 17 | +$decode = JWT::decode($jwt, $key, array('HS256')); |
| 18 | +print $decode; |
0 commit comments