Skip to content

Commit 4c74f3f

Browse files
authored
Merge pull request #285 from abby-knitta/fix/consistent-timestamp-for-issued-at-and-expired-at
fix(appstore): Use consistent timestamp for issued_at and expired_at
2 parents a5f934d + 78d0163 commit 4c74f3f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

appstore/api/token.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,12 @@ func (t *Token) Generate() error {
7676
}
7777
t.AuthKey = key
7878

79-
issuedAt := time.Now().Unix()
79+
now := time.Now()
80+
issuedAt := now.Unix()
8081
if t.IssuedAtFunc != nil {
8182
issuedAt = t.IssuedAtFunc()
8283
}
83-
expiredAt := time.Now().Add(time.Duration(1) * time.Hour).Unix()
84+
expiredAt := now.Add(time.Duration(1) * time.Hour).Unix()
8485
if t.ExpiredAtFunc != nil {
8586
expiredAt = t.ExpiredAtFunc()
8687
}

0 commit comments

Comments
 (0)