Ennea / wishing-well

Genshin Impact wish history backup and analysis.
MIT License
17 stars 4 forks source link

"Authkey timeout" when trying to update wish history #4

Open DeniablePlausibility opened 1 year ago

DeniablePlausibility commented 1 year ago

System details:

Edition Windows 10 Pro Version 21H2 OS build 19044.2006

Wishing Well version: 1.3.3

Genshin Impact version: OSRELWin3.1.0_R10676272_S10805493_D10772333

Issue: This problem actually started with Wishing Well 1.3.2 and Genshin Impact 3.0. GI is started and the wish history page is displayed in-game, then WW is launched. When "Update wish history" is pressed, it returns "Authkey timeout". I tried searching first to see if anyone else is having this issue, but didn't find anything. It was working on the previous version of GI. Help?

Ennea commented 1 year ago

That's very peculiar. The error is from Genshin's wish history endpoint. So Wishing Well finds an auth key, but it's an old one. If you go to the directory you've installed Genshin to, then navigate to Genshin Impact game\GenshinImpact_Data\webCaches\Cache\Cache_Data, you will find a bunch of files. If you make sure the game is closed first, you can go ahead and delete them all (or make a backup, that way I may be able to analyze this further; but don't upload them here directly, they contain sensitive data). Then restart Genshin and open the history again, and it should hopefully work.

DeniablePlausibility commented 1 year ago

Thank you, that fixed it. I will do that going forward if it happens again. Thanks so much for your help! I have retained the files if you want to analyze them, there are 423 files of approximately 150K before zipping.

Ennea commented 1 year ago

Do you happen to have Discord? You can add me via Ennea#9999 to send me the zipped files. I won't be online today, though, so it'll have to be tomorrow at the earliest. Thank you!

DeniablePlausibility commented 1 year ago

Unfortunately, I don't have a Discord account. I could use Pixeldrain? Please let me know if this is OK.

Ennea commented 1 year ago

Any service works, I mostly just wanted to avoid you sharing your data publicly, or me sharing my e-mail publicly. But then I remembered Firefox Relay 😁 So feel free to use any file sharing service of your liking, and send the link to i4woiltdy@mozmail.com. Thanks!

DeniablePlausibility commented 1 year ago

Sent, please check.

Ennea commented 1 year ago

Did not receive anything :( Firefox Relay also only shows one mail forwarded, which was my test mail.

DeniablePlausibility commented 1 year ago

It probably ended up in spam. OK, I will try again.

Ennea commented 1 year ago

Apparently it only allows mail attachments up to 10 MB, in case you're trying to send it as an attachment.

Edit: Got it now, thanks :) I'll take a look tomorrow.

DeniablePlausibility commented 1 year ago

OK great, I hope that helps you figure out how I screwed it up so badly. :-)

Ennea commented 1 year ago

Was probably my fault anyway 😁 I'll get back to you once I know more.

DeniablePlausibility commented 1 year ago

FYI it gave the "Auth timeout" error again tonight. As per the previous procedure, I quit the game, deleted the contents of Cache_data then started the game and all was well again. It has been approximately 13 days since the last time I ran WW, previously I was able to go for longer periods without any issues.

Ennea commented 1 year ago

This is quite strange. I couldn't find any weirdness in the file you had provided to me, either. I was wondering if maybe Genshin starts caching the URLs to a different file at some point, but that hasn't happened to me yet (or anybody else, apparently). Not really sure what to make of this.

DeniablePlausibility commented 1 year ago

I recently changed my GI account password, and noticed that WW had the auth timeout error again. Cleared out the cache, everything works again. So login credentials at the very least are stored in the cache, if that is of any use to know.

Ennea commented 1 year ago

I very much doubt that any login credentials are stored inside that cache file. Rather, I assume miHoYo invalidates any auth keys for the wish history (and probably others as well) when you change your password. Wish history auth keys are invalidated after a certain period anyway, though. 24 hours, I believe? But you're still the only person (as far as I know at least) that has this issue :/ Normally just opening up the wish history in the game again before using Wishing Well should be enough.

DeniablePlausibility commented 1 year ago

Well, clearing the cache fixes my problem, so it's not a big deal but I do find it interesting that no one else seems to be having this issue. When I'm the only one experiencing a problem the first thing I think is that I must be doing something incorrectly but I can't see how that could be happening here. It's just running the game, opening the wish log then running WW. I just don't see what I could be doing that could cause this.

TheProJeckt commented 1 year ago

I have also had this problem in the past (more than 3 times). I have always deleted the contents of my cache folder, as described above. I should have written that I also have the problem, but I only got the idea now. Unfortunately I don't have a backup of the folder, next time I will zip the folder to look for the problem.

System details:

OS: Windows 10 Pro Version: 21H2 (Build 19044.2251) (Probably newer version than at the time of the problem)

Wishing Well v1.3.3

Genshin Impact Version: OSRELWin3.2.0_R11611027_S11212885_D11793813 (Probably newer version than at the time of the problem)

FichteFoll commented 1 year ago

I've heard that the log/cache file sometimes isn't written to, not sure about the cause however. Renaming/Deleting the file before opening the wish history in game (or before launching?) should get rid of the problem. At least this is what I gathered on the Wish Tally discord.

Ennea commented 1 year ago

To write at least some sort of update: after analyzing the cache file of a friend this had also happened to, I actually thought I had found a/the solution: it seemed like the links I was searching/parsing for in the cache file were not in order. There were older links at the bottom compared to the top of the file. Then I ran into this issue myself and thought that I could now easily fix it (as the link also includes a unix timestamp as part of the parameters). Only to realize: my observation was correct, but the latest link I was expecting (from opening the history in the game just mere seconds ago) wasn't in the cache file at all. So it appears what @FichteFoll said is correct.

My proposed solution is therefore to show an extra button in Wishing Well in this case that users can use to delete the cache file (+ instructions to quit the game first, because that'll be necessary). Looks like a "bug" on Genshin's side, so I don't think there's a better option, sadly.

DeniablePlausibility commented 1 year ago

If WW could detect the "auth key timeout" error message, it can self-determine that this invalid cache condition has occurred and inform the player that in order to proceed, the game needs to be shut down and the clear cache option used before restarting the game to process new wish log entries. Leave it to the user to actually use the clear cache option, but detect the condition on your own if possible - I feel this would be the logical way to implement such a feature. Just my suggestion.

Ennea commented 1 year ago

Yea, that was the idea ;) Except I don't even have to run into the timeout, since the URLs in the cache have a timestamp, as I said. I can detect that the newest one is too old before even bothering the wish history API with it, and then suggest to the user that the cache file may require deletion. I'll try to implement this soon-ish.

DeniablePlausibility commented 1 year ago

Hi, it's me again. I know you said you're not really playing any more but... Well, it's doing the auth key timeout again after the game updated to 4.0. Deleting the cache data isn't fixing it this time. I have the latest version of WW (1.4.0).

FichteFoll commented 1 year ago

I haven't checked, but it could be that the cache path updated again after the latest update (and is likely going to be changing with each patch since it now has a version number in its path).

My1 commented 1 year ago

if it's just a version number maybe it can dynamically check?

My1 commented 1 year ago

resources.assets has MiHoYoSDK, Version=2.15.0.0, in it. maybe that's the key point