Update: implement token caching in loginInteractive and enhance error handling
This commit is contained in:
@@ -1,12 +1,21 @@
|
||||
import { loginInteractive } from "../src/auth.js";
|
||||
import { config } from "../public-config.js";
|
||||
|
||||
const scopes = ["https://management.azure.com/.default"];
|
||||
|
||||
const token = await loginInteractive({
|
||||
tenantId: config.tenantId,
|
||||
clientId: config.clientId,
|
||||
scopes,
|
||||
});
|
||||
let token;
|
||||
|
||||
try {
|
||||
token = await loginInteractive({
|
||||
tenantId: config.tenantId,
|
||||
clientId: config.clientId,
|
||||
scopes,
|
||||
});
|
||||
} catch (e) {
|
||||
console.error("Login failed:", e);
|
||||
console.error(e.stack);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log("Access token acquired:");
|
||||
console.log(token.accessToken);
|
||||
//console.log(token.accessToken);
|
||||
|
||||
Reference in New Issue
Block a user