Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
little-apps committed Jun 24, 2022
2 parents d0be4e4 + 7751208 commit f9a3a1f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ use LittleApps\LittleJWT\Build\Builder;

$token = LittleJWT::createToken(function (Builder $builder) {
$builder
// Adds claim 'abc' with value 'def' to header claims.
->abc('def', true)
// Adds claim 'ghi' with value 'klm' to payload claims.
->ghi('klm')
// Adds claim 'nop' with value 'qrs' to payload claims.
->nop('qrs', false);
});

Expand All @@ -66,8 +69,11 @@ $token = "ey...";

$passes = LittleJWT::validateToken($token, function (Validator $validator) {
$validator
// Checks the value of the 'abc' claim in the header === (strictly equals) 'def'
->equals('abc', 'def', true, true)
// Checks the value of the 'ghi' claim in the payload == (equals) 'klm'
->equals('ghi', 'klm')
// Checks the value of the 'nop' claim in the payload === (strictly equals) 'qrs'
->equals('nop', 'qrs', true, false);
});

Expand Down

0 comments on commit f9a3a1f

Please sign in to comment.