Я хочу настроить MSAL с Nodejs. Но я получаю сообщение об ошибке от терминала, когда я выполняю эту строку.
Я получаю ошибку:
(node:25500) UnhandledPromiseRejectionWarning: TypeError: this.getTelemetryManagerFromConfig is not a function
at Object.UserAgentApplication (D:\powerbi embed\NodeJS\App Owns Data\node_modules\msal\lib-commonjs\UserAgentApplication.js:87:38)
at Object.getAuthenticationToken (D:\powerbi embed\NodeJS\App Owns Data\authentication.js:11:31)
at generateEmbedToken (D:\powerbi embed\NodeJS\App Owns Data\app-owns-data-sample.js:33:32)
at Object.<anonymous> (D:\powerbi embed\NodeJS\App Owns Data\app-owns-data-sample.js:130:1)
at Module._compile (internal/modules/cjs/loader.js:955:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function.Module._load (internal/modules/cjs/loader.js:723:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
at internal/main/run_main_module.js:17:11
(node:25500) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was
not handled with .catch(). (rejection id: 2)
(node:25500) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.PS D:\powerbi embed\NodeJS\App Owns Data>
Это код:
var msal = require('msal');
// var adal = require('adal-node');
var fs = require('fs');
var https = require('https');
var config = require(__dirname + '/config.json');
console.log(config);
console.log(msal);
**const msalInstance = msal.UserAgentApplication(config);
console.log(msalInstance);**
Вот мой файл конфигурации.
{
"authorityUrl" : "https://login.microsoftonline.com/common/",
"resourceUrl" : "https://analysis.windows.net/powerbi/api",
"apiUrl" : "https://api.powerbi.com/",
"appId" : "**********************************",
"clientId" : "**********************************",
"workspaceId" : "**********************************",
"reportId" : "**********************************",
"username" : "**********************************",
"password" : "********************"
}
Вот функция, в которой это показывает ошибку в msal / lib-commonjs / UserAgentApplication. js Файл:
function UserAgentApplication(configuration) {
// callbacks for token/error
this.authResponseCallback = null;
this.tokenReceivedCallback = null;
this.errorReceivedCallback = null;
// Set the Configuration
this.config = Configuration_1.buildConfiguration(configuration);
// Set the callback boolean
this.redirectCallbacksSet = false;
this.logger = this.config.system.logger;
this.clientId = this.config.auth.clientId;
this.inCookie = this.config.cache.storeAuthStateInCookie;
**this.telemetryManager = this.getTelemetryManagerFromConfig(this.config.system.telemetry, this.clientId);** //error is referring to this line.
}
Пожалуйста, помогите. Заранее спасибо.