Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions crates/titen-core/src/threads_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,20 @@ impl ThreadsClient {
.get("access_token")
.and_then(|v| v.as_str())
.ok_or_else(|| {
crate::error::TitenError::ThreadsApiError(
"No access_token in exchange response".to_string(),
)
// Surface Meta's error body instead of a generic message:
// without this, the actual failure reason (invalid secret,
// expired code, permission scope, etc.) is discarded and the
// UI only shows "No access_token in exchange response".
let meta_err = resp.get("error").map(|e| e.to_string()).unwrap_or_default();
if meta_err.is_empty() {
crate::error::TitenError::ThreadsApiError(format!(
"No access_token in exchange response (HTTP body: {resp})"
))
} else {
crate::error::TitenError::ThreadsApiError(format!(
"No access_token in exchange response: Meta error: {meta_err}"
))
}
})?
.to_string();

Expand Down
Loading