dependabot-preview[bot] on composer
Bump phpunit/phpunit from 9.5.0… (compare)
dependabot-preview[bot] on composer
Bump phpstan/phpstan from 0.12.… (compare)
dependabot-preview[bot] on composer
Bump phpstan/phpstan-strict-rul… (compare)
@laurenskok it's indeed not properly documented in the README.md, however the method is available in the builder https://github.com/lcobucci/jwt/blob/c9704b751315d21735dc98d78d4f37bd73596da7/src/Builder.php#L195-L204
But don't forget that the alg
header is modified when you sign the token: https://github.com/lcobucci/jwt/blob/c9704b751315d21735dc98d78d4f37bd73596da7/src/Builder.php#L237
@lcobucci use Lcobucci\JWT\Builder;
$token = (new Builder())->setIssuer('http://example.com') // Configures the issuer (iss claim)
->setAudience('http://example.org') // Configures the audience (aud claim)
->setId('4f1g23a12aa', true) // Configures the id (jti claim), replicating as a header item
->setIssuedAt(time()) // Configures the time that the token was issued (iat claim)
->setNotBefore(time() + 60) // Configures the time that the token can be used (nbf claim)
->setExpiration(time() + 3600) // Configures the expiration time of the token (exp claim)
->set('uid', 1) // Configures a new claim, called "uid"
->getToken(); // Retrieves the generated token
After i run this code and get token i paste this token here https://jwt.io/ debugger and i got the error " Invalid Signature"
"message": "It was not possible to parse your key, reason: error:0909006C:PEM routines:get_name:no start line",
jsonwebtoken
library and I can verify by a hash the password the user is sending and then generate the token and send it back and afterwards use the verify
function in order to very all the upcoming transactions.