You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/api/client.rs
+38-26Lines changed: 38 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,40 @@ impl GraphClient {
37
37
})
38
38
}
39
39
40
+
fnauth_error_message(&self,body:&str) -> String{
41
+
letmut message = if body.trim().is_empty(){
42
+
"Authentication failed (401)".to_string()
43
+
}else{
44
+
format!("Authentication failed (401): {body}")
45
+
};
46
+
47
+
if body.contains("Invalid audience") || body.contains("InvalidAuthenticationToken"){
48
+
let audience = self
49
+
.token
50
+
.unverified_claims()
51
+
.and_then(|claims| claims.audience())
52
+
.unwrap_or_else(|| "unknown or opaque token".to_string());
53
+
54
+
message.push_str(&format!(
55
+
"\nHint: Microsoft Graph rejected this token audience. This CLI requires a Microsoft Graph access token; observed audience: {audience}. Run `teams auth login`, `teams auth login --device-code`, or provide a Graph token via `TEAMS_CLI_ACCESS_TOKEN`. Teams client tokens such as `~/.config/fossteams/token-teams.jwt` are not supported."
0 commit comments