File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
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
+ // JSON
9
+ $ token ='eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.IntcInN0YXR1c1wiOlwic3VjY2Vzc1wiLFwiZGF0YTFcIjpcInRlc3QxXCIsXCJkYXRhMlwiOlwidGVzdDJcIixcImRhdGEzXCI6XCJ0ZXN0M1wiLFwiZGF0YTRcIjpcInRlc3Q0XCIsXCJkYXRhNVwiOlwidGVzdDVcIn0i.lTHo7zbetlA2su017EVukpSzL1Zj60k7mEZZHxAlz7k ' ;
10
+ $ decode = JWT ::decode ($ token , $ key , array ('HS256 ' ));
11
+ print $ decode ."\n" ;
12
+ print json_decode ($ decode )."\n" ;
13
+
14
+ // plain text
15
+ $ token ='eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.IkhlbGxvLCBXb3JsZCEi.XYtTUc2xhYATDmvY0cDzCREb-uplZf03Rq1sMFhweA4 ' ;
16
+ $ decode = JWT ::decode ($ token , $ key , array ('HS256 ' ));
17
+ print $ decode ."\n" ;
You can’t perform that action at this time.
0 commit comments