web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

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

PCF component with msal for Canvas application

Like (1) ShareShare
ReportReport
Posted on 8 Mar 2023 19:49:58 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 30 Mar 2023 at 17:15:55
    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 29 Mar 2023 at 20:11:42
    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 23 Mar 2023 at 23:22:01
    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

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading complete