You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when I use JWT.Parse I get the error "Token used before issued",
after writing the entire token in the console I checked it manually several times and the iat variable is always returned with a time of 4 minutes into the future, e.g. for 10:00 the iat time is 10:04 which makes no sense.
the rest of the function works correctly
*I have the UTC +1 time zone on my computer but it shouldn't have any effect
if it's useful to you, I've bypassed the bug by adding a function with a 5-minute time tolerance
consttimeLeeway=5*time.Minuteifclaims, ok:=token.Claims.(jwt.MapClaims); ok {
now:=time.Now().UTC() // set time to UTCifiat, ok:=claims["iat"].(float64); ok {
iatTime:=time.Unix(int64(iat), 0).UTC()
ifnow.Before(iatTime.Add(-timeLeeway)) {
returnnil, fmt.Errorf("token used before issue time (iat)")
}
}
ifnbf, ok:=claims["nbf"].(float64); ok {
nbfTime:=time.Unix(int64(nbf), 0).UTC()
ifnow.Before(nbfTime.Add(-timeLeeway)) {
returnnil, fmt.Errorf("token used before 'not before' (nbf) time")
}
}
ifexp, ok:=claims["exp"].(float64); ok {
expTime:=time.Unix(int64(exp), 0).UTC()
ifnow.After(expTime.Add(timeLeeway)) {
returnnil, fmt.Errorf("token is expired")
}
}
} else {
log.Println("Could not parse claims")
returnnil, fmt.Errorf("could not parse claims")
}
The text was updated successfully, but these errors were encountered:
when I use JWT.Parse I get the error "Token used before issued",
after writing the entire token in the console I checked it manually several times and the iat variable is always returned with a time of 4 minutes into the future, e.g. for 10:00 the iat time is 10:04 which makes no sense.
the rest of the function works correctly
*I have the UTC +1 time zone on my computer but it shouldn't have any effect
src:
https://pastebin.com/aU09PhkT
if it's useful to you, I've bypassed the bug by adding a function with a 5-minute time tolerance
The text was updated successfully, but these errors were encountered: