Decouple the Flow from The Power App to prevent end-user authentication

Ever since 2016, when Power Apps was first released, I’ve found it to be a very useful tool. I’m certainly not alone in feeling this way, as for a customer’s recent project, they wanted to Convert Power Apps screens to PDF. I got this working for them, but when the App was deployed, they started getting an authentication prompt for each user.

Almost there . 
Decouple-TEST needs your permission to use: 
Muhimbi PDF 
a Connection by Microsoft 
Switch account 
Signed in 
Don't Allow

So, what is happening? Why is this authentication prompt popping up for users, but everything worked fine for me?

The answer is short and easy to explain. Connectors’ credentials are not saved alongside the Power App. As a result, upon first use of a Power App, each user needs to manually authenticate against all connectors used in the App. This means setting up a separate, or shared account, for each user in each connector, very inconvenient.

As sharing credentials is not a best practice and connector providers (including Muhimbi) are not in control of this aspect of the way Power Apps works, may I ask for 1 minute of your time to vote for this Flow idea.

Luckily, there is a good workaround, which is detailed below. In summary, we ‘decouple’ the flow from the Power App by writing to SharePoint from the App. We then use the full version of Power Automate to attach the Flow, which does all the work, to the SharePoint list or library. Flows associated with SharePoint do not require each user to authenticate. Easy and convenient. In a future post I will explain how to apply the same principle without using SharePoint as an intermediate.

When sharing my Power Apps with End users, this was the message I received:

‘Data permissions​: Make sure your users have access to the data used in your app, including gateways, APIs, connectors, and entities‘.

Share Decouple-TEST 
Add people as Users and Co-owners to your app. Make sure your data connections have been shared With all users. 
Enter a name, email address. or Evegyone 
New users 
Clavin Fernandes 
Shared With 
test clavin 
Sort by Name 
Clavin Fernandes 
This user can use this app. 
Can use, edit share app but not delete or change owner. 
Make sure your users have access to the data used in your app, 
including gateways. APIs. connectors, and entities. 

In the Power Automate (Flow) portal, I could not find an option to ‘Share the Connection‘ or manage ‘Run only users‘ and that was indeed the cause of the problem.

Convert Response to PDF 
D escrfptim 
Create one more actions to happen when a button or link 
in is selected. TO use this flow from a PowerApp, 
select the control you want to trigger the flow •rd go to the 
Action tab in the powerApps ribbon and select Flows. 
Original template c: 
28-day run history 
Aug 19, 05:16 PM min ago) 
Aug PM 
Mod ified 
Aug 19, 05:06 PM 
Per-user plan 
Share Point 
All runs 

Now that we understand the problem, lets quickly have a look at the Power Apps and Power Automate (Flow).

Power Apps – Canvas APP with a Single Text-Input(TextInput1) and Button(Button1)

  • On the Button, ‘OnSelect‘ property, I have associated a Power Automate(Flow) and used the ‘Run‘ function and passed the TextInput1.Text. ‘ConvertResponsetoPDF.Run(TextInput1.Text)‘.
Navigate v 
Tree view 
Screens Components 
v Screenl 
X Remove v On select 
v Text) 3 
This is Testing 

Power Automate – To Convert Data returned by Power Apps to PDF.

  • Use the Power Apps Trigger.
  • Initialized variable (Feedback) of Type String and select on ‘Ask in Power Apps‘. (This is the variable that need passing between your Power Apps).
  • Compose action – This will hold our HTML.
  • Muhimbi Convert HTML to PDF‘ action – Passed the output of the Compose action to Convert HTML to PDF.
  • SharePoint ‘Create File‘ action – Create a file in SharePoint.

Initialize variable 
• Name 
compose HTML 
Convert HTML to PDF 
Feedback X 
• Source JRI_ or HTML 
Show aCvanced options v 
Create file 
• Site Address 
Fclder Path 
File N•me 
• File content 
Processed file

The Solution? Use The Decoupled or Indirect  approach in Power Automate (Flow)

The ‘Decoupled’ or ‘Indirect’ approach, is to create a Flow in the Document Library to which we write the HTML file and that Flow should be set to an automatic trigger, such as ‘When a File is Created in a folder’.

If you observe the screenshot below, I have removed the ‘Muhimbi Convert HTML to PDF‘ action and instead of writing PDF to SharePoint I am writing the HTML file.

Note: In the SharePoint ‘Create File’ action, I using the ‘Concat’ function in the ‘File Name‘ to create unique file names in SharePoint.


First decoupled Power Automate(Flow)

• Name 
Initialize variable 
Compose HTML 
Create file 
• Site Address 
Folder Path 
• File content 
Feedback X 
x .htm• 
Outputs x

Second decoupled Power Automate(Flow)

  • Lets create another Power Automate(Flow) and add the Conversion Logic. Note: The Folder path for ‘When a File is Created in a folder‘ should be exactly the same of the previous Power Automate(Flow) ‘Create file‘ action.
  • The new Power Automate(Flow) would be a simple ‘Three Step’ Flow, as shown below.

When a file is created in a folder 
• Site Address 
•Folder Id 
'Feed b"kH TM 
Show •dv•rced options v 
Ccnvert document 
• Source "de name 
• Source "e content 
Output fcrmat 
Sho,v advanced options 
File Content 
Create file 
Site Address 
• Folder 
• File Nyme 
File Content 
Feed backsPOF 
3ase n:me X .pdf 
Processed file x

Now when you End user launches the APP, he will not get the Muhimbi Sign-in Prompt.

Almost there . 
Decouple-TEST needs your permission to use: 
Signed in Yieæpeuniss.ions 
Don't Allow
If you want to get rid of the SharePoint Prompt, use the PowerShell command ‘Set-AdminPowerAppApisToBypassConsent’.

Fill in the details in the Power App, click on the Submit button and after a few seconds, you should have a PDF in your SharePoint Folder.

Subscribe to this blog for the latest updates about SharePoint Online, Microsoft Flow, Power Apps and document conversion and manipulation.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s