TF2Autobot / tf2autobot

tf2autobot: an Improved version from tf2-automatic
https://autobot.tf
MIT License
217 stars 80 forks source link

fix: remove refresh token on access denied #1776

Closed Nicklason closed 3 months ago

Nicklason commented 3 months ago

When logging in the bot removes error listeners and only adds them back when successfully logged in. This means that if you first start the bot and get the accessdenied error, then the bot will keep crashing because it keeps trying to sign in using the invalid refresh token.

Bot registers handler for error events on the client:

https://github.com/TF2Autobot/tf2autobot/blob/133b3da1d3e96a66fe93c2d698d3d1d02ccf5bea/src/classes/Bot.ts#L846 https://github.com/TF2Autobot/tf2autobot/blob/133b3da1d3e96a66fe93c2d698d3d1d02ccf5bea/src/classes/Bot.ts#L1616-L1644

Bot removes error listeners when attempting to log in:

https://github.com/TF2Autobot/tf2autobot/blob/133b3da1d3e96a66fe93c2d698d3d1d02ccf5bea/src/classes/Bot.ts#L1389-L1397

Bot does not handle access denied errors in the login error handler:

https://github.com/TF2Autobot/tf2autobot/blob/133b3da1d3e96a66fe93c2d698d3d1d02ccf5bea/src/classes/Bot.ts#L1408-L1417

idinium96 commented 3 months ago

Thank you @Nicklason! I will look into this. Looks right already.