Skip to main content

fetch_token_from_endpoint

Function fetch_token_from_endpoint 

Source
pub async fn fetch_token_from_endpoint(
    url: &str,
    method: &Method,
    headers: &HeaderMap,
    body: Option<&Value>,
    token_path: &str,
    response_validator: Option<&ResponseValidator>,
) -> Result<String, FaucetError>
Available on crate feature source-rest only.
Expand description

Fetch a token from the given endpoint and extract it using JSONPath.

This is the public one-shot variant for callers who want to fetch a token without caching (e.g. for use with Auth::Bearer).