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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Embedding Power Automa...
Power Apps
Unanswered

Embedding Power Automate within an iframe

(0) ShareShare
ReportReport
Posted on by 2

Hello,

I am a React developer working for a company that develops a SaaS application. We are looking to integrate Power Automate into our app. As a first step, I am responsible for creating a proof of concept (POC) to embed Power Automate within an iframe inside our application. I have been following the official documentation: Embed flows in your application, but aside from that, I haven’t found many resources or examples on this topic. Has anyone here successfully implemented something similar? Any insights, best practices, or potential challenges to watch out for?

Thanks in advance!

I have the same question (1)
  • SaiRT14 Profile Picture
    1,990 Super User 2025 Season 2 on at
     
    set up an iframe to embed Power Automate in your React app:
    import React from 'react';
    const PowerAutomateEmbed = () => {
      const flowUrl = "https://flow.microsoft.com/embedded/your-flow-id"; // Replace with your flow URL
      return (
        <div>
          <iframe 
            src={flowUrl} 
            width="100%" 
            height="600px" 
            title="Power Automate Flow" 
            frameBorder="0"
          />
        </div>
      );
    };
    export default PowerAutomateEmbed;
     
     
    pls try.
     
    thanks.
  • Verified answer
    NB-31011305-0 Profile Picture
    2 on at

    Thx for your response @SaiRT14
     

    I developed a React component, PowerAutomatePage, integrates Microsoft authentication (MSAL) and Power Automate’s SDK to embed a Flow creation widget.

    • Authentication (MSAL):
      • Uses PublicClientApplication to handle authentication via Microsoft Entra ID (formerly Azure AD).
      • Supports popup-based login and silent token acquisition.
      • Stores the access token in state after authentication.
    • Power Automate SDK Integration:
      • Initializes MsFlowSdk if available.
      • Renders a Flow Creation widget inside the flowsDiv container.
      • Listens for GET_ACCESS_TOKEN events and provides the stored token for authentication.

    But I have this 404 error due to my widget:

     

    {
        "error": {
            "code": "NonExistentSettingGroup",
            "message": "The setting group 'PAutoModernLeftNavToolbox_prod' does not exist."
        }
    }

     

    This is my actual code

     
    const msalConfig = {
      auth: {
        clientId: '********', // app registration id
        authority: 'https://login.microsoftonline.com/********', // tenant id
        redirectUri: 'http://localhost:3000',
      },
      cache: {
        cacheLocation: 'sessionStorage',
        storeAuthStateInCookie: false,
      },
    }
     
    const msalInstance = new PublicClientApplication(msalConfig);
     
    const PowerAutomatePage = () => {
      const [accessToken, setAccessToken] = useState(null);
      const sdk = useRef();
     
      const getActiveAccountCallback = async account => {
        try {
          msalInstance.setActiveAccount(account);
          const tokenResponse = await msalInstance.acquireTokenSilent({ ...loginRequest, account });
          setAccessToken(tokenResponse.accessToken);
        } catch (error) {
          console.error('Error getting active account:', error);
        }
      };
     
      const handleLogin = async () => {
        try {
          const accountResponse = await msalInstance.loginPopup(loginRequest);
          await getActiveAccountCallback(accountResponse.account);
        } catch (error) {
          console.error('Error with login popup:', error);
        }
      };
     
      useEffect(
        () => {
          (async () => {
            await msalInstance.initialize();
            const currentAccounts = msalInstance.getAllAccounts();
            if (currentAccounts.length > 0) await getActiveAccountCallback(currentAccounts[0]);
            if (window.MsFlowSdk) {
              const sdkInstance = new window.MsFlowSdk({
                hostname,
                locale: 'en-US',
              });
              sdk.current = sdkInstance;
            } else {
              console.error('MsFlowSdk is not available. Check if the script is loaded correctly.');
            }
          })();
        },
        [],
      );
     
      useEffect(
        () => {
          const container = document.getElementById('flowsDiv');
          if (!sdk.current || !accessToken || !container) return;
          const widget = sdk.current.renderWidget('flowCreation', {
            container: 'flowsDiv',
            flowsSettings: {},
            templatesSettings: {},
            approvalCenterSettings: {},
            widgetStyleSettings: {},
         });
         widget.listen('GET_ACCESS_TOKEN', (requestParam, widgetDoneCallback) => {
            widgetDoneCallback(null, {
              token: accessToken,
           });
         });
        },
        [sdk.current, accessToken],
      );
     
      return !accessToken ? (
        <Button onClick={handleLogin}>Connect</Button>
      ) : (
        <Div_FlowContainer id="flowsDiv" />
      );
    };

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard