问题描述
我实际上在使用Apache捆绑软件的symfony4和php7.2.9上。我正在尝试使用lexikJWT捆绑包。我已经用邮递员和curl命令测试了请求。标头以json发送(用于json_login函数)。
我遇到什么错误404错误。
来自文档的配置似乎很简单,所以我不明白我在做什么错
/ api / test工作正常
我还注意到/ api将我发送到根目录
security.yaml
providers:
# used to reload user from session & other features (e.g. switch_user)
app_user_provider:
entity:
class: App\Entity\User
property: email
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
login_check:
pattern: ^/api/login
stateless: true
anonymous: true
json_login:
check_path: /api/login_check
success_handler: lexik_jwt_authentication.handler.authentication_success
failure_handler: lexik_jwt_authentication.handler.authentication_failure
api:
pattern: ^/api
stateless: true
guard:
authenticators:
- lexik_jwt_authentication.jwt_token_authenticator
routes.yaml
api_login_check:
path: /api/login_check
php bin/console debug:router login_check
:
+--------------+---------------------------------------------------------+
| Property | Value |
+--------------+---------------------------------------------------------+
| Route Name | login_check |
| Path | /api/login_check |
| Path Regex | #^/api/login_check$#sD |
| Host | ANY |
| Host Regex | |
| Scheme | ANY |
| Method | POST |
| Requirements | NO CUSTOM |
| Class | Symfony\Component\Routing\Route |
| Defaults | NONE |
| Options | compiler_class: Symfony\Component\Routing\RouteCompiler |
+--------------+---------------------------------------------------------+```
`php bin/console router:match /api/login_check`:
[OK] Route "api_login" matches
+--------------+-----------------------------------------------------------+
| Property | Value |
+--------------+-----------------------------------------------------------+
| Route Name | api_login |
| Path | /api/login_check |
| Path Regex | #^/api/login_check$#sD |
| Host | ANY |
| Host Regex | |
| Scheme | ANY |
| Method | ANY |
| Requirements | NO CUSTOM |
| Class | Symfony\Component\Routing\Route |
| Defaults | _controller: App\Controller\SecurityController::api_login |
| Options | compiler_class: Symfony\Component\Routing\RouteCompiler |
+--------------+-----------------------------------------------------------+
如果您有任何建议,我会接受! 提前谢谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)