stackotter / delta-client

An open source Minecraft Java Edition client built for speed.
https://deltaclient.app
GNU General Public License v3.0
313 stars 33 forks source link

Failed to Refresh Account #163

Open garv-shah opened 1 year ago

garv-shah commented 1 year ago

Sometimes if you've been playing for a while it will fail to refresh your Minecraft account, a temporary fix could be to add a logout option but probably better to find a more reliable way to refresh accounts :D

garv-shah commented 1 year ago

oh nevermind seems you can already logout on the linux branch, are there any issues that prevent refreshing the accounts?

stackotter commented 1 year ago

@JWhitmore1 is also getting this issue, and I've gotten it occasionally. Still not really sure what causes it to happen. It's likely related to the login system not really being synchronised so maybe if two refreshes happen at once it breaks? How often does this happen for you?

garv-shah commented 1 year ago

happened twice so far, a quick logout seemed to fix it perhaps a launcher like multimc or prism has had a similar issue before? not sure, but I could do some digging

stackotter commented 1 year ago

I think the best course of action would be for me to add a bunch of debugging logs to investigate potential causes. That way when it happens again the person who it happened to can hopefully send me some logs. I really need to implement a proper log file system...

garv-shah commented 1 year ago

oh yeah, for sure thatโ€™s probably better! proper logging would be great especially for fixing bugs like this :)

stackotter commented 1 year ago

I'll try and get a file logging system working today ๐Ÿคž

stackotter commented 1 year ago

It looks like I did already add some logging in the past, and I just ran into this issue as well. Here's the error returned from the Microsoft API:

{
  "error": "invalid_scope",
  "error_description": "AADSTS70011: The provided value for the input parameter 'scope' has not been pre-authorized for this client application.\r\nTrace ID: 492b2dc9-fc89-4897-9bc2-f6a38ec71c00\r\nCorrelation
 ID: 0185fd6b-02ef-45d6-a3dc-dd27935a91be\r\nTimestamp: 2023-01-17 04:02:14Z",
  "error_codes": [70011],
  "timestamp": "2023-01-17 04:02:14Z",
  "trace_id": "492b2dc9-fc89-4897-9bc2-f6a38ec71c00",
  "correlation_id": "0185fd6b-02ef-45d6-a3dc-dd27935a91be"
}

This is the scope that it's referring to in the error: service::user.auth.xboxlive.com::MBI_SSL.

Not exactly sure what this means yet

stackotter commented 1 year ago

I've implemented log files now ๐ŸŽ‰ and you can even use the View > Logs menu item to view the logs live in the built-in macOS Console app

garv-shah commented 1 year ago

nice!

garv-shah commented 1 year ago

Had the issue again, the logs reported the following:

[2023-01-18T12:51:33.977+11:00] [DeltaClient] [WARNING] LAN server enumeration failed: failedToReadFromSocket(DeltaCore.SocketError.disconnected)
[2023-01-18T12:51:35.170+11:00] [DeltaCore] [DEBUG] {"error":"invalid_scope","error_description":"AADSTS70011: The provided value for the input parameter 'scope' has not been pre-authorized for this client application.\r\nTrace ID: 3da2aba8-eab5-4749-8c6f-2bc71cd03400\r\nCorrelation ID: 0b445333-39c0-43d5-82d1-ff01d51b7f28\r\nTimestamp: 2023-01-18 01:51:35Z","error_codes":[70011],"timestamp":"2023-01-18 01:51:35Z","trace_id":"3da2aba8-eab5-4749-8c6f-2bc71cd03400","correlation_id":"0b445333-39c0-43d5-82d1-ff01d51b7f28"}
[2023-01-18T12:51:35.172+11:00] [DeltaClient] [ERROR] Failed to refresh account 'gorbs': accountRefreshFailed(DeltaCore.RequestError.unsuccessfulRequest(400))

so basically the same as what you find before D:

stackotter commented 1 month ago

This seems to happen consistently whenever delta client attempts to refresh the user's Microsoft account. I tried changing the scope in the refresh request to match the scope we use in the initial authentication request, but to no avail. Might be worth looking at around at a few other Minecraft authentication implementations to see what they do (e.g. bixilon's Minosoft).

Bixilon commented 1 month ago

there are refrsh tokens at every stage. minosofts attempt works fine, even after months

On May 29, 2024 2:18:21 PM GMT+02:00, stackotter @.***> wrote:

This seems to happen consistently whenever delta client attempts to refresh the user's Microsoft account. I tried changing the scope in the refresh request to match the scope we use in the initial authentication request, but to no avail. Might be worth looking at around at a few other Minecraft authentication implementations to see what they do (e.g. bixilon's Minosoft).

-- Reply to this email directly or view it on GitHub: https://github.com/stackotter/delta-client/issues/163#issuecomment-2137272508 You are receiving this because you are subscribed to this thread.

Message ID: @.***>

stackotter commented 1 month ago

Yeah, I know that it's meant to work ๐Ÿ˜…

What do you mean by refresh tokens at every stage? As in there are refresh tokens for every single step of the authentication (which would be a bit weird) or there are refresh tokens every time that you make a request (pretty sure that delta client should be handling those fine but worth double checking).

Just left the above comment in case anyone looks into it, cause I'm not looking into it at the moment; working on block breaking and inventory stuff.

Bixilon commented 1 month ago

so, normally u use the auth token. Every auth token has an expire date (which is sent in the api too). If it expired, you need to refresh both tokens using the provided refresh token. if that is expired/broken you can will go one step back in the whole pipeline (with auth/refresh token).

(my brain): oauth login -> msa login -> xbox login -> minecraft

stackotter commented 1 month ago

Hm yeah makes sense, I vaguely remember you saying something like that, perhaps we've already talked about the exact same issue on a call one time lol