我刚安装并配置了LexikJWTAuthenticationBundle,如提供的示例所示。
但是当我尝试生成令牌时
带
curl -X POST http://localhost:8000/api/login_check -d _username=johndoe -d _password=test
我使用正确的用户名和密码
我明白了:
{"error":{"code":500,"message":"Internal Server Error","exception":[{"message":"Failed to load private key \"\/home\/web\/symfony\/app\/var\/jwt\/private.pem\". Did you correctly configure the corresponding passphrase?
如何调试此错误?
答案 0 :(得分:0)
请先在app / config / security.yml文件中设置提供者,如下所示: -
providers:
in_memory:
memory:
users:
johndoe:
password: test
roles: 'ROLE_USER'
完成上述设置后,您可以运行以下命令,在运行以下命令后,您将获得令牌,请使用该令牌作为您的请求:
curl -X POST http://localhost:8000/api/login_check -d _username=johndoe -d _password=test
有关设置的更多信息,请参阅以下链接: - enter link description here