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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user