rust - simple code to get access tokens via client credentials
This is my rust code to get a client credentials access token with the intention of doing performance test. The client id, client secret and endpoint is configurable as environment variables. use chrono ::{ DateTime , Utc , Duration }; use indicatif ::{ ProgressBar , ProgressStyle }; use serde :: Deserialize ; use std :: env ; #[ derive ( Debug , Deserialize )] pub struct TokenResponse { pub access_token : String , pub expires_in : i64 , } pub struct AuthClient { client_id : String , client_secret : String , token_url : String , http_client : reqwest :: Client , } impl AuthClient { pub fn new ( client_id : String , client_secret : String , token_url : String ) -> Self { Self { client_id , client_secret , ...