Preserve original expiry when refreshing token (#4580)

To avoid shortening the token expiration time during
refreshing cause client reconnect failed after network
down for a long time (>5min).
This commit is contained in:
cnderrauber
2026-06-10 14:51:10 +08:00
committed by GitHub
parent 8d2b827f44
commit 7dc6877738
10 changed files with 125 additions and 9 deletions
+3
View File
@@ -28,6 +28,7 @@ import (
"strconv"
"strings"
"sync"
"time"
"github.com/ua-parser/uap-go/uaparser"
"gopkg.in/yaml.v3"
@@ -289,6 +290,7 @@ type ValidateConnectRequestParams struct {
type ValidateConnectRequestResult struct {
roomName livekit.RoomName
grants *auth.ClaimGrants
tokenExpiresAt time.Time
region string
createRoomRequest *livekit.CreateRoomRequest
}
@@ -402,6 +404,7 @@ func ValidateConnectRequest(
}
res.grants = claims
res.tokenExpiresAt = GetTokenExpiresAt(r.Context())
return res, http.StatusOK, nil
}