ms-teams-cli icon indicating copy to clipboard operation
ms-teams-cli copied to clipboard

`presence clear` omits the required `sessionId`; `presence set` invents a random one

Open aberoham opened this issue 3 months ago • 1 comments

Graph models presence writes as an application presence session. Both setPresence and clearPresence carry the note "Provide the ID of the application as sessionId in the request", and sessionId is the only body parameter clearPresence accepts. The CLI does neither thing.

presence clear sends an empty body

clear_presence posts {} (src/api/presence.rs:30-33), and the subcommand takes no arguments to supply one (src/cli/presence.rs:57-58). Graph rejects it:

$ teams presence clear
API error (400): {"error":{"code":"InvalidArgument",
  "message":"[SessionId]: The SessionId field is required." ... }}

The token used here also lacked Presence.ReadWrite, and Graph still answered with the session-ID error rather than a permission error — so granting that scope will not make this call work.

presence set generates a fresh UUID per invocation

src/cli/presence.rs:131 sets session_id: uuid::Uuid::new_v4().to_string(). No two invocations share a session identifier, and nothing the user can pass names an earlier one.

Fix

Use the effective authentication client ID for both calls — resolve_client_id (src/config.rs:178), which falls back to the built-in OSO_PUBLIC_CLIENT_ID (src/config.rs:9) because a profile's client_id is optional. set and clear have to agree on the value, or clear has no way to target the session set opened.

Seen on teams-cli 0.4.0, delegated work-account token.

Related: #70 (the missing Presence.ReadWrite scope). Both need fixing before presence clear can work.

aberoham avatar Aug 21 '26 21:08 aberoham

Hi @aberoham we are working through these and accept you might have to wait until next week.

sionsmith avatar Aug 25 '26 15:08 sionsmith