Skip to main content

test_sf_auth_url/
test_sf_auth_url.rs

1//! Test SF_AUTH_URL authentication
2//!
3//! Run with: `SF_AUTH_URL=<auth_url> cargo run --example test_sf_auth_url`
4
5use busbar_sf_auth::{Credentials, SalesforceCredentials};
6
7#[tokio::main]
8async fn main() {
9    let auth_url = std::env::var("SF_AUTH_URL").expect("SF_AUTH_URL must be set");
10
11    println!("Testing SF_AUTH_URL authentication...");
12
13    match SalesforceCredentials::from_sfdx_auth_url(&auth_url).await {
14        Ok(creds) => {
15            println!("✓ Successfully authenticated!");
16            println!("Instance URL: {}", creds.instance_url());
17            println!("API Version: {}", creds.api_version());
18            println!("Access token length: {}", creds.access_token().len());
19        }
20        Err(e) => {
21            eprintln!("✗ Authentication failed: {:?}", e);
22            eprintln!("\nError details: {}", e);
23            std::process::exit(1);
24        }
25    }
26}