pub struct AuthClient { /* private fields */ }Expand description
Authentication client for APS
Handles OAuth 2.0 token acquisition for both 2-legged and 3-legged flows.
Implementations§
Source§impl AuthClient
impl AuthClient
Sourcepub async fn login_device(&self, scopes: &[&str]) -> Result<StoredToken>
pub async fn login_device(&self, scopes: &[&str]) -> Result<StoredToken>
Login with 3-legged OAuth using manual PKCE flow (headless-friendly).
- Generates a PKCE code verifier / challenge pair.
- Prints an authorization URL for the user to open in any browser.
- Prompts the user to paste back the callback URL (or bare code).
- Exchanges the authorization code + verifier for tokens.
Source§impl AuthClient
impl AuthClient
Sourcepub async fn get_3leg_token(&self) -> Result<String>
pub async fn get_3leg_token(&self) -> Result<String>
Get a valid 3-legged access token (requires prior login)
Uses Mutex-based coordination to ensure only one refresh occurs at a time. Concurrent callers wait and receive the newly refreshed token.
Sourcepub async fn is_logged_in(&self) -> bool
pub async fn is_logged_in(&self) -> bool
Check if user is logged in with 3-legged OAuth
Sourcepub async fn login(&self, scopes: &[&str]) -> Result<StoredToken>
pub async fn login(&self, scopes: &[&str]) -> Result<StoredToken>
Start 3-legged OAuth login flow
Sourcepub async fn get_user_info(&self) -> Result<UserInfo>
pub async fn get_user_info(&self) -> Result<UserInfo>
Get user profile information (requires 3-legged auth with user:read or user-profile:read scope)
Sourcepub async fn get_token_expiry(&self) -> Option<i64>
pub async fn get_token_expiry(&self) -> Option<i64>
Get token expiry timestamp
Source§impl AuthClient
impl AuthClient
Sourcepub fn delete_stored_token(&self) -> Result<()>
pub fn delete_stored_token(&self) -> Result<()>
Delete stored token
Sourcepub async fn login_with_token(
&self,
access_token: String,
refresh_token: Option<String>,
expires_in: u64,
scopes: Vec<String>,
) -> Result<StoredToken>
pub async fn login_with_token( &self, access_token: String, refresh_token: Option<String>, expires_in: u64, scopes: Vec<String>, ) -> Result<StoredToken>
Login with a provided access token (for CI/CD scenarios)
Source§impl AuthClient
impl AuthClient
Source§impl AuthClient
impl AuthClient
Sourcepub fn new_with_http_config(
config: Config,
http_config: HttpClientConfig,
) -> Self
pub fn new_with_http_config( config: Config, http_config: HttpClientConfig, ) -> Self
Create a new authentication client with custom HTTP config
Trait Implementations§
Source§impl Clone for AuthClient
impl Clone for AuthClient
Source§fn clone(&self) -> AuthClient
fn clone(&self) -> AuthClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AuthClient
impl !RefUnwindSafe for AuthClient
impl Send for AuthClient
impl Sync for AuthClient
impl Unpin for AuthClient
impl UnsafeUnpin for AuthClient
impl !UnwindSafe for AuthClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more