JSON Object JWT expiry date

Hi folks

Anyone have ideas how to verify JWT JSON Token expiry date using Golang.
My environment is Tyk Api Gateway.

Thanks
Wee Tat

Wouldn’t it be just time.Now().Before(time.UnixMicro(jwtexp*1000000)) ?

exp Expiration Time Identifies the expiration time on and after which the JWT must not be accepted for processing. The value must be a NumericDate:[9] either an integer or decimal, representing seconds past 1970-01-01 00:00:00Z.

Hi
Thanks. Do we have public golang JWT packages available which i can use or import ?

If i create golang module , how to convert it to plugin to use in Tyk ?
The link below show how to do it:

However can help to explain as i am new in Golang ? Thanks

Here’s a plugin tutorial:

I’m not familiar at all with Tyk, but it seems like you are maybe trying to create a middleware plugin. In addition to those links Jeff posted did you check this out?

https://tyk.io/docs/plugins/supported-languages/golang/

It also looks like you were asking for a go module to help you work with JWTs. This is well maintained and I’ve used it on a few projects:

So, follow the Tyk docs to create a middleware, then parse the JWT using that library and set a header or do something with the response based on the expiration date.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.