import { login, CaptchaError, type UserInfo } from "@byrdocs/bupt-auth";
try {
const res: UserInfo = await login(bupt_id, bupt_pass);
console.log(res)
} catch (e) {
if (e instanceof CaptchaError) {
// 如果需要验证码
console.log("Captchas required. ")
console.log("\tCaptcha URL: ", e.captcha());
console.log("\tCookie:", e.cookie())
// 携带 cookie 获取验证码图片,然后输入验证码
const captcha = await input("Captcha: ");
const res: UserInfo = await e.resolve(captcha);
console.log(res)
} else {
throw e;
}
}
-
Notifications
You must be signed in to change notification settings - Fork 1
byrdocs/bupt-auth
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
登录北京邮电大学统一认证,并获取用户基本信息。
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published