Updating JWT token

Hey.
Since my extension should be stable in terms of non-updated page I would like to know how to update JWT token. I am using one that I get in the very beginning of the session. It expires after some time of the page being open. How do I update JWT? I tried to do that:

if (window.Twitch.ext) {
          var Gauth;
            window.Twitch.ext.onAuthorized(function(auth) {
                Gauth = auth;
            });
)

By putting this inside periodic update and then used Gauth. But it didn’t work out: Gauth happened to be undefined.
How do I go about updating tokens?
Thanks.

Panels auto reload and provide a new auth periodically on their own.

You shouldn’t have to do anything

I have the exact same issues. The panel does not update. My logs are absolutely spammed with jwt expired errors. This error only occurs when a user tries to interact with my extension. So that means while they are trying to use it, it’s expiring. I never see that user functional again for a long period of time. Just a spam of jwt expire errors. I’m this close to doing jwt decoding without verification of authenticity because my extension just can’t function long enough without it.

I’ve had zero reports from my users users to support this.

Both extensions where I would expect reports for this have reported no issues.

it is possible that a browser extension such as FFZ could be interferring

Hello,

Same issue here. We are receiving expired JWT tokens (from a few minutes to hours). Anything new on that topic?
Will the same callback “OnAuthorized” be invoked again on Jwt renewal, or should we register to another one?

Thanks.

onAuth will be refired every hour to refresh the token. You need to ensure that the “Gauth” var is globally accessible and blocks functionality until you get that token back (when the user has fully loaded into Twitch) to ensure your’re not making unauthed calls.