Skip to content

Commit f2e4b4a

Browse files
Merge pull request #350 from supertokens/fix-jwt-expiry
fix: Fix jwt expiry check logic
2 parents a2b451b + fad93af commit f2e4b4a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

recipe/session/sessionwithjwt/recipeImplementation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func MakeRecipeImplementation(originalImplementation sessmodels.RecipeInterface,
5353
}
5454
jwtExpiry := uint64(decodedPayload["exp"].(float64)) - currentTimeInSeconds
5555

56-
if jwtExpiry <= 0 {
56+
if jwtExpiry < 1 {
5757
// it can come here if someone calls this function well after
5858
// the access token and the jwt payload have expired (which can happen if an API takes a VERY long time). In this case, we still want the jwt payload to update, but the resulting JWT should
5959
// not be alive for too long (since it's expired already). So we set it to

recipe/session/sessionwithjwt/sessionContainer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func newSessionWithJWTContainer(originalSessionClass sessmodels.SessionContainer
5454

5555
jwtExpiry := uint64(decodedPayload["exp"].(float64)) - currentTimeInSeconds
5656

57-
if jwtExpiry <= 0 {
57+
if jwtExpiry < 1 {
5858
// it can come here if someone calls this function well after
5959
// the access token and the jwt payload have expired (which can happen if an API takes a VERY long time). In this case, we still want the jwt payload to update, but the resulting JWT should
6060
// not be alive for too long (since it's expired already). So we set it to

0 commit comments

Comments
 (0)