背景
$configuration = Configuration::forSymmetricSigner(
// You may use any HMAC variations (256, 384, and 512)
new Sha256(),
// replace the value below with a key of your own!
InMemory::base64Encoded('YWFhc0pOU0RLSkJITktKU0RiamhrMTJiM2Joa211')
// You may also override the JOSE encoder/decoder if needed by providing extra arguments here
);
使用jwt生成秘密的时候,报错Key provided is shorter than 256 bits, only 240 bits provided
问题分析
使用InMemory::base64Encoded
时密钥少了四位字符,导致生成的密钥长度只有240