Use the validate endpoint to check the current expiration of a token. Or check expires_in when a token is obtained
Generailly speaking:
implict token - 60 days - can’t be refreshed, manual remake
regular token - 4 hours - has refresh token to auto obtain a new token
app access - 60 days - just get a new token, doesn’t represent a user (included for completeness it’s not usable for what you want to do, unless talking to eventsub)
If you were using EventSub webhook transport:
authenticate the user
discard the token
use an app access token to create Topics
then it works forever! No token faffery.
But you can’t eventsub with an SE Widget.
Odd that they don’t include access to the SE token that SE has, and/or they don’t provide a way to get an oAuth token anyway