Skip to content

Commit

Permalink
修复刷新 token 的 BUG (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
flycash authored Mar 26, 2024
1 parent 2c593de commit 0c3345e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions session/redis/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,9 @@ func (rsp *SessionProvider) RenewAccessToken(ctx *ginx.Context) error {
}
claims := jwtClaims.Data
sess := newRedisSession(claims.SSID, rsp.expiration, rsp.client, claims)
defer func() {
// refresh_token 只能用一次,不管成功与否
_ = sess.Del(ctx, keyRefreshToken)
}()
oldToken := sess.Get(ctx, keyRefreshToken).StringOrDefault("")
// refresh_token 只能用一次,不管成功与否
_ = sess.Del(ctx, keyRefreshToken)
// 说明这个 rt 是已经用过的 refreshToken
// 或者 session 本身就已经过期了
if oldToken != rt {
Expand Down

0 comments on commit 0c3345e

Please sign in to comment.