Allow option to keep login account saved on failure
Okay, so let me explain. I use a VPN for privacy. Every now and then, maybe 1 out of every 20 times I launch Bolt, my login fails. This is due to jagex blocking my IP entirely. Usually all I have to do is disconnect and reconnect to my VPN so it gets a different node, which usually isn't blocked. Easy. However, Bolt makes me log in again when this happens. I have to load up the jagex login window, get my 2fa key, get my 2fa code, get my password, solve the captcha, and it's quite annoying, when it otherwise would have been 2 clicks to get into the game.
I would love the ability to not "lose" the login, and have Bolt just close, let me reconnect to another VPN node, then open Bolt again to try the login again with the previously saved account, which will then work.
This is for OSRS, if that makes a difference.
Edit: per @Notloc below, this would also help with Jagex downtime or unexpected internet outages, really anything that could make a login fail.
+1 for this.
At the time of this comment, the login servers are down, which caused Bolt to clear my credentials after receiving a 504. This is not a desired behaviour..
Normally a fail response means that your credentials are invalid or have just been invalidated, so a setting wouldn't help with that. It might be that we're handling some responses incorrectly, though. I don't think it's supposed to discard them on any 5xx for example.
Yeah it would be fine to discard them on specifically a "login incorrect" response, then keep them in all other scenarios.
Bumping, as it still discards my login when I am blocked by cloudflare. This happens on a weekly basis.
d01e9ce adds a setting "discard_expired_sessions" which is on by default. If unchecked, sessions will never be discarded except when manually pressing the "log out" button, and you can still attempt to log into the game even if the session couldn't be refreshed. This works because JX_SESSION_ID remains valid unless it goes unused for 30 days, or unless it actually got invalidated by the login server.
The same commit also adds a check to make sure we only discard sessions in response to 4xx errors. Invalid sessions always seem to result in 4xx errors (in fact, from memory, I think the Jagex launcher is even more specific than that about which set of 4xx errors it'll actually discard on.) Errors relating to login server issues or cloudflare are usually 5xx.
Here's the most recent error I got, which is the same as always:
2:31:42 PM - Unable to sign into saved user 'redacted' - please sign in again. Failed to fetch user. Status: 403
This is what I get when trying to log in:
The ideal solution would be for me to close Bolt, switch VPN server, then it loads the previous login. Now, if I switch VPN server it remains logged out, but doesn't say I'm blocked and makes me log in again.
With the latest release, unchecking "discard expired sessions" fixes this for me. I saw the 403 error in the log at the bottom when I opened the launcher, then simply switched my VPN node to a random new one and clicked play and it successfully logged me in and allowed me to play without having to enter my login details again. Thank you for the fix!