我正在为我的Laravel REST API使用Tymon / JWT-Auth软件包。 在我的 未经身份验证的用户的路由将忽略授权标头。 但是,如果标题有效,我想要一个可以利用授权用户数据的路由组,如果没有设置或无效,我会做其他事情。 p>
有没有办法 实现这样的功能,或者可能是JWTAuth包内置中间件的解决方案? p>
div> routes.php code>文件中,我可以添加针对未经身份验证的用户的路由以及针对经过身份验证的用户的路由。 p>
I'm using the Tymon/JWT-Auth package for my Laravel REST API. In my routes.php
file I can add routes meant for unauthenticated users and routes for authenticated users.
Routes for unauthenticated users ignore the authorization header. However, I'd like a route group that can utilize the authorized users data if the header is valid and do something else if it isn't set or invalid.
Is there any way to implement such functionality, or maybe a solution in the JWTAuth package built-in middleware?