Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use CookieManager from javafx #94

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mymedia2
Copy link

Use com.sun.webkit.network.CookieManager provided by javafx, not java.net.CookieManager which is not capable of processing RFC 6265 styled cookies. I believe the tool should not access cookies individually and, instead, store them as a whole in a CookieJar. But we are where we are.

Nevertheless, this patch fixes login by QR code.

Closes: #64

 * It supports RFC-6265 cookies which account.xiaomi.com server is using.
 * Scan login cookies after each successful navigation. Unfortunately, this
   CookieManger does not provide public API to retrieve stored cookies. So we
   parse them by hand from the Cookie header.
 * This commit fixes login by QR-code.
 * Reset default CookieHandler on logout. The javafx.web module should
   reinstantiate it as its CookieManager before loading first web page.
nazarewk added a commit to nazarewk/XiaoMiToolV2 that referenced this pull request Feb 28, 2023
francescotescari#41 - login URL fix
francescotescari#94 - Use CookieManager from javafx
francescotescari#67 - update JavaFX to show captcha properly

finishes with:
Failed to unlock your device, Xiaomi server returned error 20045:
Error descripiton: Unknown error: 20045
Server description: Please use common user tool on the official website
 * The Mi Unlock app sends web requests with "miNative/1.0" user agent string.
 * Simulate this so that the server would send confirmation codes. If we don't,
   user is unable to login.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fails to save login info
2 participants