Don’t worry, we’ve got you! This post will prevent users from needing to enter an API Key in Power Automate for SharePoint Flows.
We receive lots of support calls where users have created a Flow associated with a SharePoint document library or a Flow related to a PowerApp, which they have then shared with their team or organisation… however, each user accessing the Flow is prompted to enter an API Key for an action for which the connector uses API Key authentication… less than ideal!
This post outlines how you can avoid this prompt for SharePoint-associated Flows.
If you are using Power Apps, please review the following post: Prevent API Key authentication prompts in Power Apps and Power Automate
How do you avoid this? (SharePoint Library)
I have set up the following example Flow associated with a SharePoint Library:
As the user who created the Flow, I can see the option to invoke the Flow. Other users will not yet be able to see the Flow:
To share the Flow and the contained connections, follow these steps negating the need for users to enter either credentials or an API Key to use the actions/connections embedded within the Flow:
STEP 1: Share the Flow
1. Navigate to your Flows in Power Automate, select your target flow, click ‘…‘, and click ‘Details.‘
2. Inside the ‘Run only users‘ block, click ‘Edit.‘
The referenced article is an excellent resource. We typically recommend granting the list/library run-only permissions as this negates the need to separately manage permissions between the Flow and the list/library in future.
3. Click ‘SharePoint.‘
4. Select the Site where the Flow is contained and the library to which the Flow is associated, and click ‘Add.‘
Once these changes are saved, your flow will be visible to all users who have read/write access to the SharePoint document library.
STEP 2: Share the connections
By default, all connections used by actions within the flow will be set to ‘Provided by run-only user‘, which means each user who attempts to execute the flow must set up their connections.
When users attempt to run the flow for the first time, they are prompted to create the connections.
Connectors which use OAuth will prompt the user to sign in, and connectors which use API Key authentication (Like Encodian) will prompt the user to enter an API Key, which is not ideal!
To prevent this, we simply need to set each connection to use an existing connection and not require the user to create a new one.
NOTE: If there are tasks you would prefer to execute as the current user (Like creating a new document), it makes sense to ask the user to create the connection. However, there is no benefit for the Encodian connector, and we recommend you share an existing connection.
1. Click on the drop-down list of the connection you wish to share
2. Select one of the existing connections
3. Click ‘OK.‘
4. Repeat as required for any other connection within your flow.
5. Click ‘Save.‘
The connections within the example flow will now be shared, negating the need for an end-user to create new connections, simplifying the experience.
It’s time for the last step to preventing users from needing to enter an API Key in Power Automate. Let’s validate…
Every user who has read /written to the library will now be able to execute the Flow:
Upon selecting the Flow, users will click ‘Run Flow‘… no need to create new connections!
… and the flow will execute using the shared connections:
For explicitness, we will create another post shortly providing detailed steps on how to do this with Flows used by a PowerApp.
We hope you’ve found this post about preventing users from needing to enter an API Key in Power Automate useful, and as ever, please share any feedback or comments – all are welcome!