fix(msteams): improve graph user and token parsing

This commit is contained in:
Peter Steinberger
2026-02-22 11:28:19 +00:00
parent e80c66a571
commit 8c1afc4b63
9 changed files with 145 additions and 85 deletions

View File

@@ -1,6 +1,7 @@
import type { MSTeamsConfig } from "openclaw/plugin-sdk";
import { GRAPH_ROOT } from "./attachments/shared.js";
import { loadMSTeamsSdkWithAuth } from "./sdk.js";
import { readAccessToken } from "./token-response.js";
import { resolveMSTeamsCredentials } from "./token.js";
export type GraphUser = {
@@ -22,18 +23,6 @@ export type GraphChannel = {
export type GraphResponse<T> = { value?: T[] };
function readAccessToken(value: unknown): string | null {
if (typeof value === "string") {
return value;
}
if (value && typeof value === "object") {
const token =
(value as { accessToken?: unknown }).accessToken ?? (value as { token?: unknown }).token;
return typeof token === "string" ? token : null;
}
return null;
}
export function normalizeQuery(value?: string | null): string {
return value?.trim() ?? "";
}