This commit is contained in:
@ -1,12 +1,17 @@
|
||||
use crate::http_client::HttpClient;
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub async fn post_request(handle: String, pass: String, host: String) -> String {
|
||||
pub async fn post_request(handle: String, pass: String, host: String, auth_factor_token: Option<String>) -> String {
|
||||
let url = format!("https://{}/xrpc/com.atproto.server.createSession", host);
|
||||
|
||||
let mut map = HashMap::new();
|
||||
map.insert("identifier", &handle);
|
||||
map.insert("password", &pass);
|
||||
|
||||
// Add 2FA code if provided
|
||||
if let Some(code) = &auth_factor_token {
|
||||
map.insert("authFactorToken", code);
|
||||
}
|
||||
|
||||
let client = HttpClient::new();
|
||||
|
||||
|
Reference in New Issue
Block a user