30 lines
720 B
JavaScript
Executable File
30 lines
720 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
import { loginInteractive } from "sk-az-tools/azure";
|
|
|
|
const config = {
|
|
tenantId: "ce45d437-ed75-4a4f-9d57-87e1ef73f8d6",
|
|
clientId: "187960e4-499e-4334-95ec-70a9d70cbd3a",
|
|
};
|
|
|
|
async function main() {
|
|
const graphApiToken = await loginInteractive({
|
|
tenantId: config.tenantId,
|
|
clientId: config.clientId,
|
|
scopes: ["https://graph.microsoft.com/.default"],
|
|
});
|
|
|
|
const accessToken = graphApiToken?.accessToken;
|
|
|
|
if(!accessToken) {
|
|
throw new Error("Failed to obtain Microsoft Graph API token");
|
|
}
|
|
|
|
console.log("Successfully obtained Microsoft Graph API token.");
|
|
}
|
|
|
|
main().catch((err) => {
|
|
console.error("An error occurred:");
|
|
console.error(err);
|
|
process.exit(1);
|
|
});
|