azure-docs icon indicating copy to clipboard operation
azure-docs copied to clipboard

msal.js config file for logging does not work

Open bachoang opened this issue 2 years ago • 3 comments

[Enter feedback here]


Document Details

Besides the issue raised in https://github.com/MicrosoftDocs/azure-docs/issues/99854 There are also other places that need to change as well since the syntax used in that doc is for typescript and does not work in JS env. Below is the complete working config file (with Jason Nutter's help)

const msalConfig = { auth: { clientId: "xxx", // This is the ONLY mandatory field; everything else is optional. authority: b2cPolicies.authorities.signUpSignIn.authority, // Choose sign-up/sign-in user-flow as your default. knownAuthorities: [b2cPolicies.authorityDomain], // You must identify your tenant's domain as a known authority. redirectUri: "xxx", // You must register this URI on Azure Portal/App Registration. Defaults to "window.location.href". }, cache: { cacheLocation: "localStorage", // Configures cache location. "sessionStorage" is more secure, but "localStorage" gives you SSO. storeAuthStateInCookie: false, // If you wish to store cache items in cookies as well as browser cache, set this to "true". }, system: { loggerOptions: { logLevel: msal.LogLevel.Verbose, loggerCallback: (level, message, containsPii) => { if (containsPii) { return; } switch (level) { case msal.LogLevel.Error: console.error(message); return; case msal.LogLevel.Info: console.info(message); return; case msal.LogLevel.Verbose: console.debug(message); return; case msal.LogLevel.Warning: console.warn(message); return; } }, piiLoggingEnabled: true }, }, };

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

bachoang avatar Oct 14 '22 16:10 bachoang

@bachoang Thanks for your feedback! We will investigate and update as appropriate.

Naveenommi-MSFT avatar Oct 14 '22 17:10 Naveenommi-MSFT

@bachoang Thanks for bringing this to our attention. I'm going to assign this to the document author so they can take a look at it accordingly

ManoharLakkoju-MSFT avatar Oct 17 '22 09:10 ManoharLakkoju-MSFT

@Dickson-Mwendia Can you please check and add your comments on this doc update request as applicable.

ManoharLakkoju-MSFT avatar Oct 17 '22 09:10 ManoharLakkoju-MSFT