Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Unanswered

PCF component with msal for Canvas application

(1) ShareShare
ReportReport
Posted on by 4

Hi, 


I am trying to setup a PCF for a canvas application integrated with MSAL, so that I can access other Azure services from the PCF. Can this be done? I tried using the PublicClientApplication to get the access token, but I am not sure what should be used for the redirect uri. I have tried ssoSilent and acquireTokenSilent methods.

I am able to get it to work in the local test environment. But, when I import it into powerapps, I get the following error.

 

BrowserAuthError: monitor_window_timeout: Token acquisition in iframe failed due to timeout. For more visit: aka.ms/msaljs/browser-errors.

 

Here is the config for the PublicClientApplication

 

    this.msalConfig = {
      auth: {
        clientId: "xxxxxx",
        authority:
        redirectUri: "https://xxxxxxxxxx.dynamics.com/main.aspx",
      },
      cache: {
        cacheLocation: "localStorage", // This configures where your cache will be stored
        storeAuthStateInCookie: true, // Set this to "true" if you're having issues on Internet Explorer 11 or Edge
      },
      system: {
        loggerOptions: {
          loggerCallback: (
            level: msal.LogLevel,
            message: string,
            containsPii: boolean
          😞 void => {
            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: false,
          logLevel: msal.LogLevel.Verbose,
        },
        windowHashTimeout: 60000,
        iframeHashTimeout:60000,
        loadFrameTimeout: 60000,
      },
    };

 

  • manojpatel20dec Profile Picture
    17 on at
    Re: PCF component with msal for Canvas application

    try redirect uri as below quoted format where {ClientId} is your app registration id from azure:

    "msal{ClientId}://auth"

  • psethuraman Profile Picture
    4 on at
    Re: PCF component with msal for Canvas application

    Thanks for your response. I have tried your uri and a few other uris as well. However, once the PCF is imported into a canvas app, it blocks the redirects and popups. I still have not found a solution for my issue. 

  • dturley Profile Picture
    2 on at
    Re: PCF component with msal for Canvas application

    For a canvas app, trying using this for the redirect uri:

    https://pa-static-ms.azureedge.net/resource/webplayerdynamic/publishedapp/preloadindex

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 109 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 82 Super User 2025 Season 1

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 72

Overall leaderboard