Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

chore: log token on jwt decode failure (#1735)

Will Hutchinson6b563e745739
diff --git a/rust/cloud-storage/authentication_service/src/api/jwt/refresh.rs b/rust/cloud-storage/authentication_service/src/api/jwt/refresh.rs
index c4429f642d..41302f58d0 100644
--- a/rust/cloud-storage/authentication_service/src/api/jwt/refresh.rs
+++ b/rust/cloud-storage/authentication_service/src/api/jwt/refresh.rs
@@ -81,7 +81,7 @@ pub async fn handler(
// We only want to refresh the token if it's expired
MacroAuthError::JwtExpired => {}
_ => {
- tracing::error!(error=?e, "unable to decode jwt");
+ tracing::error!(error=?e, token=?token_context.access_token, "unable to decode jwt");
return Err(RefreshError::Unauthorized);
}
},
diff --git a/rust/cloud-storage/authentication_service/src/api/middleware/extract_tokens.rs b/rust/cloud-storage/authentication_service/src/api/middleware/extract_tokens.rs
index 8f67ed4dfe..c9a0a96daa 100644
--- a/rust/cloud-storage/authentication_service/src/api/middleware/extract_tokens.rs
+++ b/rust/cloud-storage/authentication_service/src/api/middleware/extract_tokens.rs
@@ -7,7 +7,7 @@ use axum::{
};
use macro_auth::error::MacroAuthError;
-// Extracts the access token and refresh token and inserts into TokenContext
+/// Extracts the access token and refresh token and inserts into TokenContext
pub(in crate::api) async fn handler(mut req: Request, next: Next) -> Result<Response, Response> {
let headers = req.headers();
let access_token = match macro_auth::headers::extract_access_token_from_request_headers(headers)
diff --git a/rust/cloud-storage/macro_auth/src/headers.rs b/rust/cloud-storage/macro_auth/src/headers.rs
index c82705f84b..fe44aaac52 100644
--- a/rust/cloud-storage/macro_auth/src/headers.rs
+++ b/rust/cloud-storage/macro_auth/src/headers.rs
@@ -6,6 +6,7 @@ use crate::{
error::MacroAuthError,
};
+/// Extracts the access token from request headers
pub fn extract_access_token_from_request_headers(
headers: &axum::http::HeaderMap,
) -> Result<String, MacroAuthError> {
@@ -56,6 +57,7 @@ pub fn extract_access_token_from_request_headers(
Err(MacroAuthError::NoAccessTokenProvided)
}
+/// Extracts refresh token from request headers
pub fn extract_refresh_token_from_request_headers(
headers: &axum::http::HeaderMap,
) -> Result<String, MacroAuthError> {