node.jsazure-ad-msaladalmsal.jsadal.js

[NodeJs Upgrading from ADAL to MSAL]: Cannot create property 'authenticationScheme' on string


We are Upgrading from ADAL to MSAL when doing so we are facing issues. enter image description here

The Code we implemented is

 const msal = require('@azure/msal-node');
  const msalConfig = {
        auth: {
            clientId: config.clientId,
            authority: config.authorityUrl,
            clientSecret: config.clientSecret,
            knownAuthorities: [],
        },
    }
 let cca = new msal.PublicClientApplication(msalConfig);
   const tokenResponse = async function() {
        console.log("callled tokenr response");

        try {
          const response =  cca.acquireTokenByUsernamePassword(config.scopeBase,config.pbiUsername,config.pbiPassword);
          
          return Promise.resolve(response);
        } catch(error) {
  
         return Promise.reject(error);
        }

Can anyone help me how can i fix this issue. Thanks!


Solution

  • acquireTokenByUsernamePassword accepts a single parameter which should be an object with the shape defined here. You are passing in 3 parameters of type string.