Let’s say you’ve authored a Custom Connector and created a Flow associated with Power Apps which has then been shared with your team and wider organization. You get a call asking why, when end users start using the APP, they get an authentication prompt, requiring them to enter their credentials or API key? This is not ideal for number of reasons, as it means setting up a separate, or a shared account for each user in each connector. Obviously a rather cumbersome and not very flexible solution.
In this post, I’ll explain how we can work-around the sign-in prompt problem by sharing the connection to your Custom Connector with specific users or an entire organization.
For the purposes of this example, I’ll be using the Muhimbi Connector Open API definition file.
- Before you begin, please make sure the following prerequisites are in place:
- An Office 365 subscription with access to PowerApps and Power Automate.
- Muhimbi PDF Converter Services Online full, free or trial subscription (Start trial)
- The appropriate privileges to create PowerApps and Flows.
- Working knowledge of both PowerApps and Flow.
Step 1 – Steps 1 and 2 are specific to setting up The Muhimbi Connector, if you have a Custom Connector, you can skip these steps.
- Download the ‘OpenAPI’ file and Download the Muhimbi icon.
- Login to Power Automate and navigate to the Custom Connector page and Import the OpenAPI file.
- On the General page, upload the connector icon and review the information that was imported from the OpenAPI definition.
- On the Security page, please add the information below –
- Client ID: PPF29A64-8D58-4092-A64A-04A0E7CEAE7B
- Client Secret: ppcdefghilmnbpqrstuvzabrstuvzabchgldpnkmngrreweds=
- Authorization URL: https://api.muhimbi.com/auth/pages/authorize.aspx
- Token URL: https://api.muhimbi.com/auth/pages/gettoken.aspx?grant_type=authorization_code
- Refresh URL: https://api.muhimbi.com/auth/pages/gettoken.aspx?grant_type=refresh_token
- Scope: Leave empty
- On the definitions page, leave the default settings.
- Skip the Code Review Step and click on ‘Create Connector’ at the top of the page.
- On the Test page, select ‘+New connection’.
- Enter the Muhimbi Credentials and then select ‘Create connection’.
- In Power Automate, you are taken back to the Test page. Select the ‘refresh’ icon to make sure the connection information is updated.
- Save the Connector.
Step 2 – Let’s recreate the problem – Create a 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)‘.
Power Automate – To Convert Data returned by Power Apps to PDF.
- Use the Power Apps Trigger.
- Initialize variable (Feedback) of Type String and select ‘Ask in Power Apps‘. (This is the variable that needs to be passed 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.
When you Share you APP with an end user they will get a Prompt –
Step 3 – To get around the prompt, you will have to Share the connection with the user\Entire Organization –
- Navigate to make.powerapps.com and select Data -> Connections from left navigation.
- Select the required connection.
- Click on (…) beside the connection and then click on Share.
- Select the users you want to Share the connection with or ‘Add everyone in my org’ and click on ‘Save’.
- Your users should no longer be prompted to ‘Sign In‘ to create an connection when using the PowerApps.
Subscribe to this blog for the latest updates about SharePoint Online, Power Automate (Microsoft Flow), Power Apps and document conversion and manipulation.
2 thoughts on “Prevent Authentication Prompts in Power Apps and Power Automate for Custom Connectors”
Calvin – I’ve tried to implement this and followed it step by step, but I run into an error every time I try to run the flow. “API has been disabled due to inactivity. Please update the Custom Connector to enable it again.”
Okay, I got past that error. I needed to add the connector as data in the Power App.
Now running the flow again, from the app, I get a new error that says ‘Error 404 Resource not found’