Description
Currently, seems the only credential refresh function this library has is for client credentials(ref 1, ref 2).
I propose an implementation where the library is able to use a user-supplied grant code or refresh token(along with the client id and client secret) to generate a new access token when it becomes invalid or if it is not supplied to begin with.
The motivation is that it'll make the maintenance of a simple chatbot made with the Command Extension(say, by following library example) much simpler. Currently, if a person wants to set up that example, they have to choose between making their own implementation of Authorization code grant flow, or opening a web browser and using Implicit grant flow every time they notice their access token has expired.
With Authorization code grant flow implemented, user interaction will only be required when the user changes their password or if they disconnect the app. ref 3 (or maybe when twitch decides to rotate the keys, for some reason). The server could be left unattended for longer periods of time.
Once this is implemented, it should be easy to update the PubSub hook for when the tokens are expired.