Skip to content

Auth Clients

AuthClient

Auth client component.

Methods:

check_mobile_number_validity async

check_mobile_number_validity(mobile: str) -> bool

Check if a mobile number is valid (it's registered on Miyoushe).

Returns True if the mobile number is valid, False otherwise.

cn_login_with_password async

cn_login_with_password(account: str, password: str, *, encrypted: bool = False, port: int = 5000, geetest_solver: Optional[Callable[[SessionMMT], Awaitable[SessionMMTResult]]] = None) -> CNWebLoginResult

Login with a password via Miyoushe loginByPassword endpoint.

Note that this will start a webserver if captcha is triggered and geetest_solver is not passed.

create_mmt async

create_mmt() -> MMT

Create a geetest challenge.

generate_fp async

generate_fp(*, device_id: str, device_board: str, oaid: str) -> str

Generate an authentic device fingerprint.

login_with_app_password async

login_with_app_password(account: str, password: str, *, encrypted: bool = False, port: int = 5000, geetest_solver: Optional[AppGeetestSolver] = None, device_id: Optional[str] = None, device_model: Optional[str] = None, device_name: Optional[str] = None) -> AppLoginResult

Login with a password via HoYoLab app endpoint.

Note that this will start a webserver if captcha is triggered and geetest_solver is not passed.

If email verification is triggered (can happen on first login with a new device), the verification code will be requested via CLI input.

Raises
  • AccountLoginFail: Invalid password provided.
  • AccountDoesNotExist: Invalid email/username.
  • VerificationCodeRateLimited: Too many verification code requests.

login_with_mobile_number async

login_with_mobile_number(mobile: str, *, encrypted: bool = False, port: int = 5000) -> MobileLoginResult

Login with mobile number, returns cookies.

Only works for Chinese region (Miyoushe) users, do not include area code (+86) in the mobile number.

Steps: 1. Sends OTP to the provided mobile number. 2. If captcha is triggered, prompts the user to solve it. 3. Lets user enter the OTP. 4. Logs in with the OTP. 5. Returns cookies.

login_with_password async

login_with_password(account: str, password: str, *, port: int = 5000, encrypted: bool = False, geetest_solver: Optional[Callable[[SessionMMT], Awaitable[SessionMMTResult]]] = None) -> Union[WebLoginResult, CNWebLoginResult]

Login with a password via web endpoint.

Endpoint is chosen based on client region.

Note that this will start a webserver if captcha is triggered and geetest_solver is not passed.

Raises
  • AccountLoginFail: Invalid password provided.
  • AccountDoesNotExist: Invalid email/username.

login_with_qrcode async

login_with_qrcode() -> QRLoginResult

Login with QR code, only available for Miyoushe users.

os_game_login async

os_game_login(account: str, password: str, *, encrypted: bool = False, port: int = 5000, geetest_solver: Optional[Callable[[RiskyCheckMMT], Awaitable[RiskyCheckMMTResult]]] = None) -> GameLoginResult

Perform a login to the game.

Raises
  • IncorrectGameAccount: Invalid account provided.
  • IncorrectGamePassword: Invalid password provided.

os_login_with_password async

os_login_with_password(account: str, password: str, *, port: int = 5000, encrypted: bool = False, token_type: Optional[int] = 6, geetest_solver: Optional[Callable[[SessionMMT], Awaitable[SessionMMTResult]]] = None) -> WebLoginResult

Login with a password via web endpoint.

Note that this will start a webserver if captcha is triggered and geetest_solver is not passed.

Raises
  • AccountLoginFail: Invalid password provided.
  • AccountDoesNotExist: Invalid email/username.

verify_mmt async

verify_mmt(mmt_result: MMTResult) -> None

Verify a geetest challenge.

AppAuthClient

App sub client for AuthClient.

Methods:

generate_app_device_id staticmethod

generate_app_device_id() -> str

Generate a random device ID for app login.

WebAuthClient

Web sub client for AuthClient.

Methods:

generate_web_device_id staticmethod

generate_web_device_id() -> str

Generate a random device ID for web login.

GameAuthClient

Game sub client for AuthClient.