Skip to content

Commit

Permalink
fixed: middleware jwt err == utils.TokenExpired 修改为 errors.Is(err, ut…
Browse files Browse the repository at this point in the history
…ils.TokenExpired)
  • Loading branch information
SliverHorn committed Mar 13, 2023
1 parent 419c677 commit 28e43a0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/middleware/jwt.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package middleware

import (
"errors"
"strconv"
"time"

Expand Down Expand Up @@ -35,7 +36,7 @@ func JWTAuth() gin.HandlerFunc {
// parseToken 解析token包含的信息
claims, err := j.ParseToken(token)
if err != nil {
if err == utils.TokenExpired {
if errors.Is(err, utils.TokenExpired) {
response.FailWithDetailed(gin.H{"reload": true}, "授权已过期", c)
c.Abort()
return
Expand Down

0 comments on commit 28e43a0

Please sign in to comment.