Add explicit login/logout flows and browser selection

This commit is contained in:
2026-02-08 20:35:36 +01:00
parent 5888cb4d1a
commit 2180d5aa4c
6 changed files with 392 additions and 54 deletions

View File

@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
import { loginInteractive } from "../azure/index.js";
import { Client } from "@microsoft/microsoft-graph-client";
import { acquireResourceTokenFromLogin } from "../azure/index.js";
/**
* Initialize and return a Microsoft Graph client
@@ -13,10 +13,10 @@ import { Client } from "@microsoft/microsoft-graph-client";
* @returns { Promise<{ graphApiToken: Object, client: Object }> } An object containing the Graph API token and client
*/
export async function getGraphClient({ tenantId, clientId }) {
const graphApiToken = await loginInteractive({
const graphApiToken = await acquireResourceTokenFromLogin({
tenantId,
clientId,
scopes: ["https://graph.microsoft.com/.default"],
resource: "graph",
});
const client = Client.init({