Skip to content

Commit 653e334

Browse files
authored
Create detect-header.php
1 parent 79a3892 commit 653e334

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

detect-header.php

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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+
$token='eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJzdGF0dXMiOiJzdWNjZXNzIiwiZGF0YTEiOiJ0ZXN0MSIsImRhdGEyIjoidGVzdDIiLCJkYXRhMyI6InRlc3QzIiwiZGF0YTQiOiJ0ZXN0NCIsImRhdGE1IjoidGVzdDUifQ.nOa6tq6bDCiURP2GpTehux3geHiNiqQKJXaZ0M_uJ0WD0yTmKM66LS23fCAMraem58HWnmlX4V4WB7-eTfFpbQ';
9+
$tokens = explode('.', $token);
10+
list($headb64, $bodyb64, $cryptob64) = $tokens;
11+
$header = JWT::jsonDecode(Firebase\JWT\JWT::urlsafeB64Decode($headb64));
12+
var_dump($header);

0 commit comments

Comments
 (0)