Skip to main content

fetch_oauth2_token

Function fetch_oauth2_token 

Source
pub async fn fetch_oauth2_token(
    token_url: &str,
    client_id: &str,
    client_secret: &str,
    scopes: &[String],
) -> Result<String, FaucetError>
Available on crate feature source-rest only.
Expand description

Fetch an OAuth2 token using the client credentials grant.

Prefer using TokenCache::get_or_refresh to avoid fetching a new token on every request.