A Rust CLI for publishing thought records. Designed to work with thought.stream.

Improve authentication error detection for token refresh

Enhanced error handling to catch more authentication error types including
ExpiredToken errors, ensuring more reliable automatic token refresh.

+4 -3
+4 -3
src/client.rs
··· 104 104 } 105 105 106 106 pub async fn publish_blip(&mut self, content: &str) -> Result<String> { 107 - // Try the request, and if it fails with 401, refresh and retry once 107 + // Try the request, and if it fails with auth error, refresh and retry once 108 108 match self.try_publish_blip(content).await { 109 109 Ok(uri) => Ok(uri), 110 110 Err(e) => { 111 - // Check if this is a 401 error by examining the error message 111 + // Check if this is an authentication error by examining the error message 112 112 let error_msg = e.to_string(); 113 - if error_msg.contains("401") || error_msg.contains("Unauthorized") { 113 + if error_msg.contains("401") || error_msg.contains("Unauthorized") || 114 + error_msg.contains("ExpiredToken") || error_msg.contains("Token has expired") { 114 115 // Try to refresh the session 115 116 match self.refresh_session().await { 116 117 Ok(_) => {