Basic Authentication
Recipe | Crates | Categories |
---|---|---|
Perform a Basic HTTP Authentication |
Perform a Basic HTTP Authentication
Uses reqwest::RequestBuilder::basic_auth
to perform a basic HTTP authentication.
use reqwest::Error;
use reqwest::blocking::Client;
fn main() -> Result<(), Error> {
let client = Client::new();
let user_name = "testuser".to_string();
let password: Option<String> = None;
let response = client
.get("https://httpbin.org/")
.basic_auth(user_name, password)
.send();
println!("{:?}", response);
Ok(())
}
Related Topics
- Cryptography.
- Encryption.
- Signatures.
- Certificates.