issork / gift

Godot IRC For Twitch addon
MIT License
150 stars 23 forks source link

ImplicitGrantFlow force opens browser window #41

Open timbeaudet opened 4 months ago

timbeaudet commented 4 months ago

In the Example (and from what I can see there is no way to solve this) the ImplicitGranFlow login will always pop open a default browser window for the user to authenticate with Twitch. I'd love to save the access token, refresh token and any other information in order to reload it after the initial page confirmation.

If I'm missing something basic, perhaps the Example, or some other place could make this more clear.

Expected: Only open the browser when access & refresh token is invalid, otherwise just use the prior tokens.

issork commented 4 months ago

Hello, check out my other example project for how to handle this: https://github.com/issork/twitch-overlay/blob/e7ce78a356cfdd10eccdb01ddb5642482128ecd0/TwitchOverlay.gd#L24

It probably is also a good idea to add it to the default repository here, so I'll do just that.

The TwitchIDConnection has a builtin validity check for the passed in token - so instantiate a new token using the constructor from the data you saved and pass it in, the TwitchIDConnection will handle the rest.

timbeaudet commented 3 months ago

Thanks, with that info I did get things working.