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
I'm parsing a token as seen below. I'm unable to get the correct value of exp in the token header. When I inspect my token with other tools (like https://jwt.io/#debugger-io) , I see this header for the token:
Without the actual token, it's hard to say. But here's what I can cob together as a minimal test case, and I can't reproduce it.
funcTestGH1136(t*testing.T) {
constsrc=`{ "ver": 2, "kid": "*****", "exp": 1716447235, "alg": "RS256", "jku": "**********" }`token:=jwt.New()
require.NoError(t, json.Unmarshal([]byte(src), token), `json.Unmarshal should succeed`)
require.NotEqual(t, token.Expiration(), time.Time{}, `token.Expiration should not be zero`)
t.Logf("%#v", token.Expiration())
}
The above test produces this result
$ go test -run=GH1136 -v
=== RUN TestGH1136
jwt_test.go:1870: time.Date(2024, time.May, 23, 6, 53, 55, 0, time.UTC)
--- PASS: TestGH1136 (0.00s)
PASS
ok github.com/lestrrat-go/jwx/v2/jwt 0.003s
I could be off, but with the test results I'm inclined to think that the token that is producing a zero time.Time is NOT the same as the token you pasted on jwt.io. I'd need more info if you're sure it's the library that is at fault.
I'm parsing a token as seen below. I'm unable to get the correct value of exp in the token header. When I inspect my token with other tools (like https://jwt.io/#debugger-io) , I see this header for the token:
Here is my demo code:
I get the following output:
The text was updated successfully, but these errors were encountered: