-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Cookie manager updating the V2 cookie results in an InvalidCookie. #151
Comments
Same. This worked recently, so the code is correct cookies = {"ltuid": ltuid, "ltoken": ltoken,
"ltuid_v2": ltuid, "ltoken_v2": ltoken}
client = genshin.Client(cookies)
account = await get_accounts(client)[0]
notes = await client.get_notes(account.uid)
|
It seems quite weird ... case
|
Howdy, I'm running into the same errors and commenting out the lines on the managers.py page is still saying the cookies are wrong. Has anyone had any luck since then? |
Then it is likely that your cookies are actually invalid. |
Is there somewhere else I need to go to get the cookies? I'm copying them directly from the cookies storage space in the developer panel. I've used both "ltuid"/"ltoken" and "ltuid_v2"/"ltoken_v2" as keys. Where else do I need to go for the cookies? |
Can you join the discord server so its easier for me to debug for you? https://discord.gg/dbXpMDw9nv |
This issue was solved in the discord server by logging out the hoyolab account then logging back in to refresh the cookies. |
I seem to be getting this error too, despite also adding cookie = {
"ltmid_v2": "",
"ltoken_v2": "",
"ltuid_v2": ""
}
async def main():
client = genshin.Client(cookie, game=genshin.Game.STARRAIL, debug=True)
await client.get_game_accounts()
await client.get_starrail_diary() logs
Genshin's monthly report works fine |
@BobbyWibowo, add |
@jokelbaf Somehow still doesn't work on my end Or more like, it is failing before hitting the monthly report API. Probably because of missing logs
But even if I kept |
@BobbyWibowo, can you try to refresh your cookies by logging out and back in? The following code works fine for me: import asyncio
import genshin
cookie = {
"ltoken_v2": "",
"cookie_token_v2": "",
"account_mid_v2": "",
"ltuid_v2": "",
}
async def main():
client = genshin.Client(cookie, game=genshin.Game.STARRAIL, debug=True)
d = await client.get_starrail_diary()
print(d)
asyncio.run(main()) |
@jokelbaf Ah cr*p, my bad... Aside from relogging, I also realized that I didn't copy I can confirm it works now. Likely would've earlier too, if I actually copied my cookies properly.
Either way, many thanks! |
Using the ltoken_v2 and ltuid_v2 cookies to make API requests, the Cookie manager updates the cookie by adding ltmid_v2 (
DEBUG:genshin.client.manager.managers:Updating cookies for 0: {'ltmid_v2', 'aliyungf_tc'}
). Subsequently, any requests will result in an Invalid Cookie.If lines 149 to 151 in
genshin\client\manager\managers.py
are commented out, thus not updating to add ltmid_v2, the same cookie can be used to make normal API requests.Same cookie and same code:
The text was updated successfully, but these errors were encountered: