zeromicro / go-zero

A cloud-native Go microservices framework with cli tool for productivity.

Home Page:https://go-zero.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Questions on token.

no-serve-people opened this issue · comments

有很多场景。是同一个接口,登陆后会获取用户态相关信息,未登录时这些信息是空,目前我们的路由机制无法实现

这个只能自行实现一个authhandler,具体参考/rest/handler/authhandler.go

这个只能自行实现一个authhandler,具体参考/rest/handler/authhandler.go
修改JWT鉴权失败返回格式是不是也要自己实现这个去处理

这就恶心了啊

这个只能自行实现一个authhandler,具体参考/rest/handler/authhandler.go
修改JWT鉴权失败返回格式是不是也要自己实现这个去处理

原来这样子处理就好了

engine := rest.MustNewServer(c.RestConf,rest.WithUnauthorizedCallback(func(w http.ResponseWriter, r *http.Request, err error) {
        // your custom callback function
}))
commented

登录态统一在业务网关中处理好,通过上下文传递到业务服务

This issue is stale because it has been open for 30 days with no activity.

This issue was closed because it has been inactive for 14 days since being marked as stale.