Working SFDX Auth URL and Client Credentials

This commit is contained in:
Wim Velzeboer
2026-09-21 21:09:09 +01:00
parent c1c69168d7
commit 512b60d9f4
10 changed files with 911 additions and 998 deletions
+42
View File
@@ -0,0 +1,42 @@
/// Error type returned by Salesforce authentication operations.
///
/// # Examples
///
/// ```rust
/// use rustsf_auth::{parse_sfdx_url, SalesforceAuthError};
///
/// let error = parse_sfdx_url("not-a-valid-sfdx-url").unwrap_err();
/// assert!(matches!(error, SalesforceAuthError::InvalidSfdxUrl));
/// ```
#[derive(Debug, thiserror::Error)]
pub enum SalesforceAuthError {
#[error("missing required configuration field: {0}")]
MissingRequiredField(&'static str),
/// The SFDX URL did not match the required format.
#[error("invalid SFDX URL")]
InvalidSfdxUrl,
/// A URL failed to parse.
#[error("invalid URL `{url}`: {source}")]
InvalidUrl {
/// The URL string that failed to parse.
url: String,
/// The underlying URL parser error.
source: url::ParseError,
},
/// Error returned by the `oauth2` crate.
#[error("OAuth2 error: {0}")]
OAuth2(String),
/// HTTP error returned by `reqwest`.
#[error("HTTP error: {0}")]
Http(#[from] reqwest::Error),
/// Error creating a Salesforce JWT assertion.
#[error("JWT error: {0}")]
Jwt(String),
}