首页 > 解决方案 > 您必须配置“public_key”或“secret_key”。[Symfony]

问题描述

我尝试使用 LexikJWTAuthentication 设置登录身份验证,我已经生成了必要的密钥

在此处输入图像描述

这是它的名称

配置/包/lexik_jwt_authentication.yaml

lexik_jwt_authentication:
    secret_key:'%kernel.project_dir%/config/jwt/private.pem' # required for token creation
    public_key:'%kernel.project_dir%/config/jwt/public.pem'  # required for token verification
    pass_phrase:'mafdhklkjkn234kas' # required for token creation, usage of an environment variable is recommended
    token_ttl:        3600

这是我尝试登录时的返回,我使用了邮递员

在此处输入图像描述

这是 vendor/lexik/jwt-authentication-bundle/DependencyInjection/LexikJWTAuthenticationExtension.php 中配置的 var_dump

在此处输入图像描述

捆绑包.php 在此处输入图像描述

标签: symfonylexikjwtauthbundle

解决方案


我得到了同样的错误,它来自“lexik_jwt_authentication.yaml”不在我的仓库中,添加它后,问题得到了解决。


推荐阅读