Skip to content

Commit c0fce3f

Browse files
authored
chore(backend): extend access token expiry (#1031)
- extend access token expiry duration when in debug mode fo an easier development experience
1 parent 421ecd4 commit c0fce3f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

measure-backend/measure-go/authsession/authsession.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"measure-backend/measure-go/server"
88
"time"
99

10+
"github.com/gin-gonic/gin"
1011
"github.com/golang-jwt/jwt/v5"
1112
"github.com/google/uuid"
1213
"github.com/jackc/pgx/v5"
@@ -80,6 +81,12 @@ func NewAuthSession(userId, teamId uuid.UUID, provider string, meta json.RawMess
8081
now := time.Now()
8182
atSecret := server.Server.Config.AccessTokenSecret
8283
atExpiryAt := now.Add(accessTokenExpiryDuration)
84+
85+
// use extended expiry when in debug mode
86+
if gin.IsDebugging() {
87+
atExpiryAt = now.Add(24 * time.Hour)
88+
}
89+
8390
accessToken, err := createAccessToken(userId, teamId, atSecret, atExpiryAt)
8491
if err != nil {
8592
return

0 commit comments

Comments
 (0)