Skip to content

@mega-yfue/eufy-sdk / LoginResult

Type Alias: LoginResult

ts
type LoginResult = 
  | {
  session: MegaLoginResult;
  status: typeof Ok;
}
  | {
  image: string;
  retry: boolean;
  status: typeof Captcha;
}
  | {
  method: string;
  status: typeof TwoFactor;
};

Outcome of login / continuation steps — a discriminated union so the caller switches on status instead of catching thrown errors for the expected captcha/2FA flow. Compare status against LoginStatus:

  • Ok — authenticated; session carries the token.
  • Captcha — solve image (a data:image/png;base64 4-char challenge) and call solveCaptcha(answer). retry is true when a prior answer was wrong.
  • TwoFactor — a code was sent (method says how); call submitVerifyCode(code). The captchaId / pending-2FA token are held internally, so continuation methods take only the user-supplied answer/code.

Independent and unofficial. Not affiliated with, endorsed by, or sponsored by Anker Innovations, Anker eufy, or eufy. "Anker eufy", "eufy" and "Anker" are trademarks of their respective owners. Use responsibly — rapid or failed logins can trigger captcha or temporary cooldowns.