Comments (9)
@flywish 你使用了哪个中间件呢?具体你可以看看Phper666\JWTAuth\Middleware\JWTAuthDefaultSceneMiddleware的逻辑,理应当前路由被匹配到后,会直接handle下个中间件了,不会进行任何jwt token校验的处理了
from jwt-auth.
如何使用这个no_check_route,实际配置文件里面有注释,具体可以看看注释
from jwt-auth.
no_check_route的路径也支持正则的方式
from jwt-auth.
from jwt-auth.
有什么报错吗?能否上传下你的demo我拉取测试下?
from jwt-auth.
我大概知道了,user/logout不能跳过token的校验,jwt的logout是必须要token才行,因为会把这个token加入到黑名单中
from jwt-auth.
环境
- hyperf:v2.2
- jwt-auth:v4.0
具体代码
- 配置全局no_check_route, 在
config/autoland/jwt.php
中设置'no_check_route' => [ ["**", "/user/login"], ],
- 使用全局中间件,使用
JWTAuthDefaultSceneMiddleware
, 在config/autoload/middlewares.php
中 设置'http' => [ Hyperf\Validation\Middleware\ValidationMiddleware::class, Phper666\JWTAuth\Middleware\JWTAuthDefaultSceneMiddleware::class ]
- 添加
/user/login
路由,添加对应控制器和方法
- 请求接口, 发现 no_check-route 中的设置并未生效,
/user/login
接口仍是400 ,提示 "Missing token"
from jwt-auth.
@flywish 中间件的问题,更新到v4.0.3可以解决这个问题,或者使用其它提供的中间件
from jwt-auth.
OK, 看到你的解决方案了,和我预想的差不多。
from jwt-auth.
Related Issues (20)
- 无效的token,走到黑名单检测的时候。blacklist.php 第97行。出现undefined HOT 4
- Install of lcobucci/jwt,phper666/jwt-auth failed HOT 4
- 依赖的lcobucci/jwt版本,已经不支持php8,希望能支持下php8的版本 HOT 6
- Call to undefined method Lcobucci\\JWT\\Builder::identifiedBy() HOT 5
- Call to undefined method Lcobucci\\JWT\\Builder::identifiedBy HOT 1
- matchRoute在scene下,获取no_check_route错误 HOT 5
- 单点登录 为什么不好使? HOT 1
- 获取token报错 HOT 2
- 4.0.5 token 一直失效 HOT 5
- 偶发出现该问题 HOT 2
- Object of class Lcobucci\JWT\Token\Plain could not be converted to string[647] HOT 2
- JWTCommand.$name属性类型问题 HOT 1
- 发布4.0版本配置文件报错 HOT 2
- token 续签 HOT 2
- 4.0.8 JWTCommand::$name must not be defined HOT 5
- 多场景的使用问题 HOT 5
- 使用application场景 HOT 5
- Call to undefined function Phper666\JWTAuth\make() HOT 2
- jwt 配置无法读取apollo配置 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jwt-auth.