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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / PCF component with msa...
Power Apps
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,
      },
    };

 

  • dturley Profile Picture
    2 on at

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

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

  • psethuraman Profile Picture
    4 on at

    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. 

  • manojpatel20dec Profile Picture
    17 on at

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

    "msal{ClientId}://auth"

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 409 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 252 Most Valuable Professional

Last 30 days Overall leaderboard