diff options
| author | Jesse Morgan <jesse@jesterpm.net> | 2025-03-02 15:48:51 -0800 | 
|---|---|---|
| committer | Jesse Morgan <jesse@jesterpm.net> | 2025-03-02 15:48:51 -0800 | 
| commit | 5f37e7663dfc7e87cf8a88a85c68eb681fa5bd4f (patch) | |
| tree | ed14fda421dc4918a775945b385e4ea8d381ecc8 /src/bin | |
| parent | 9d4e3dc0c1b7a40da64b9c38015e8628ff624ed9 (diff) | |
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/sso/main.rs | 18 | 
1 files changed, 14 insertions, 4 deletions
diff --git a/src/bin/sso/main.rs b/src/bin/sso/main.rs index 0356f3d..2e22198 100644 --- a/src/bin/sso/main.rs +++ b/src/bin/sso/main.rs @@ -60,9 +60,9 @@ enum Commands {      /// Request or refresh an access token (default command).      Login,      /// Send a curl request with an authorization header. -    Curl { -        args: Vec<String>, -    }, +    Curl { args: Vec<String> }, +    /// Print the current bearer token. +    Token,  }  #[derive(Serialize, Deserialize, Clone)] @@ -301,7 +301,7 @@ fn main() -> Result<(), Box<dyn Error>> {      if command == Commands::Login || !profile.valid_access_token() {          if profile.valid_refresh_token() {              // Try a refresh... -            // Ignore any errors  +            // Ignore any errors              if let Err(e) = profile.refresh() {                  log::info!("Failed to refresh token: {}", e);              } @@ -322,5 +322,15 @@ fn main() -> Result<(), Box<dyn Error>> {              Ok(()) /* No-op, we already took care of it above */          }          Commands::Curl { args } => do_curl(&profile, args), +        Commands::Token => { +            println!( +                "{}", +                profile +                    .access_token +                    .as_deref() +                    .expect("Must have valid access token") +            ); +            Ok(()) +        }      }  }  | 
