Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Implement automatic token refresh with Authorization code grant flow #419

Open
returnDanilo opened this issue Aug 21, 2023 · 2 comments

Comments

@returnDanilo
Copy link

returnDanilo commented Aug 21, 2023

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.

@IAmTomahawkx
Copy link
Member

Hi there, while this isn't feasible in the current release cycle (2.x), this has already been implemented in the next release cycle (3.0). Id suggest reading the token doc for 3.0 and/or trying the library (note that it is quite barebones at this point in time, and only really suitable for test code). Please do comment on ideas/requests for this, based on the docs and test branch!

@returnDanilo
Copy link
Author

returnDanilo commented Sep 3, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants