Fixes unsetup for proper twitch disconnection - #79
Conversation
kanimaru
left a comment
There was a problem hiding this comment.
But tbh. Implicit + Change for bot use seems unnesseccerily complicated. In the latest master I added a TwitchChatBot that helps you to setup chat stuff with an 2. bot account. Maybe this would solve your issue. Also I recommend using auth code flow instead of implicit.
I only support implicit to be fully Twitch compatible, but this flow is deprecated and has security issues by design.
Nevertheless the changes to unsetup stuff correctly looks fine. Also good catch on the eventsub unsubscribe. Didn't had this one on the radar!
| if response == null: | ||
| return false | ||
| else: | ||
| return response.error || response.response_code != 200 |
There was a problem hiding this comment.
Not necessary, I fixed the issue in the latest Master Commit. Response should never be null anymore.
There was a problem hiding this comment.
Ok, I've removed this part in my new commit
| HTTPServer.logError("Could not poll client %d: %s" % [_port, error_string(error)]) | ||
| client_error_occured.emit(client, error) | ||
| elif peer.get_available_bytes() > 0: | ||
| elif peer.get_status() == StreamPeerTCP.STATUS_CONNECTED and peer.get_available_bytes() > 0: |
There was a problem hiding this comment.
I'm not sure about this one why you need to check for connected at this point? it is already checked in line 76.
There was a problem hiding this comment.
I've updated this part in my new commit.
I originally made this change here because each time I connect to Twitch I have this error in my debugger.
After some researches, I updated my code. It seems that the peer.poll() can itself close the connection and return OK because it's not an error, it's just the fact that there is no more data to poll.
|
Made some changes according to your comments. I will try the auth code flow as you suggested, to see if it fits my need, but for now, with my changes the implicit flow works nicely without errors even if I login and logout again and again. |
|
And the difference between Auth and Implicit. In Implicit you getting your token via Anchor parameter that theoretically can be stolen on the way to you cause the URL isn't encrypted in an HTTPS environment and proxies / vpns etc could log it. The implicit flow was made for websites without a backend that handles the auth for it. |
Hi !
Thanks for your add-on, it really helps me to add twitch interactions to my games without redoing the same boring twitch auth again and again ^^
I've done some modifications to be able to disconnect from the currently connected Twitch account (I have a bot account and a main twitch account, so I wanted to be able to switch easily from one to the other).
I mainly added some unsetup steps and also fix some errors that came while unsubscribing eventsubs.
I mainly use public client type with implicit flow and did not try other type of authorizations, so I hope it has no side effects for them.