Updated chat service to use session id instead of client id

This commit is contained in:
2025-07-22 00:14:02 -04:00
parent 7cac892c2a
commit 2d423b0ad3

View File

@@ -39,14 +39,14 @@ impl MyChatService {
}
fn get_authenticated_id(metadata: &MetadataMap) -> Result<String, Status> {
if let Some(client_id_val) = metadata.get("x-client-id") {
if let Some(session_id_val) = metadata.get("x-session-id") {
// Convert the header to a string.
client_id_val
session_id_val
.to_str()
.map(ToString::to_string)
.map_err(|_| Status::unauthenticated("Invalid client ID header"))
.map_err(|_| Status::unauthenticated("Invalid session ID header"))
} else {
Err(Status::unauthenticated("Missing client ID header"))
Err(Status::unauthenticated("Missing session ID header"))
}
}