Create a webpage that implments the “OAuth Authorization Code” flow with the scopes you need. This can even run off localhost
This will generate a token and refresh token.
So when the token dies you can generate a new token automatically. Refresh is documented here:
You’ll need to use your website, once and then whenever the refresh token dies completely. And the “initial” token fetching will always be manual. But refreshing a token is automatic, as long as the refresh is still valid
It’s worth noting, that that bots chat login token only needs to be valid when you login, so my bots will auto refresh the token at bot start/restart and uses an app access token for other API requests.