Unexpected Invalid OAuth token error

Also just worth having a dig to make sure all your jobs that use an app access token are using the same token and you don’t have one that is being silly and always using a new token.

And check all your jobs are grabbing the token from the right place (and you don’t have one that didn’t grab the new one)

And yeah it’s potentially better to use a token till it dies, than to force renew daily. It’ll last around 60 days. So you can save some overhead with a validate call, and then don’t renew if it’s got 2+ days on it.

And yes if you do a call and the tokens dead, instant make and store a new one.

I doubt it’s an API issue but a implementation issue somewhere. Even more so in a complex system with many jobs/scripts.

I had the same issue, 2/3 of my long running server tasks would complain when the token died, as I had a cron job that would never use a stored token and always made a new one. That was fun to track down.

So, really, you want both systems here

A cronjob to handle key management, that then stores the key in redis/shared memory

And if another job (streams checker) gets a bad key, it will make a new key and put that key back into the same redis/stored memory.

FINALLY! On the matter of streams, if it’s a “fixed list of streamers”, checkout EventSub and Twitch can tell you when a stream goes live/offline