-
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathauth_captcha.rs
More file actions
31 lines (26 loc) · 873 Bytes
/
Copy pathauth_captcha.rs
File metadata and controls
31 lines (26 loc) · 873 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use tarkov::auth::LoginError;
use tarkov::hwid::generate_hwid;
use tarkov::{Error, Tarkov};
#[tokio::main]
async fn main() -> Result<(), Error> {
std::env::set_var("RUST_LOG", "tarkov=info");
env_logger::init();
let email = "me@example.com";
let password = "password";
let hwid = generate_hwid();
let t = match Tarkov::login(email, password, &hwid).await {
Ok(t) => Ok(t),
Err(Error::LoginError(e)) => match e {
// Captcha required!
LoginError::CaptchaRequired => {
// Solve captcha here and try again
let captcha = "03AOLTBLQ952pO-qQYPeLr53N5nK9Co14iXyCp...";
Tarkov::login_with_captcha(email, password, captcha, &hwid).await
}
_ => Err(e)?,
},
Err(e) => Err(e),
}?;
println!("{}", t.session);
Ok(())
}