401 unauthorised error when calling the SharePoint REST API on newly created SharePoint sites

Copper Contributor

I have a Power Automate Flow that creates a SharePoint Document Library on newly created SharePoint sites.  This worked for many months with no problems but the last few weeks it has stopped working.  Strangely, the Flow works if I log into the SharePoint site manually before running the Flow but if the site hasn't been logged into the Flow fails with a 401 unauthorized message.


I've tried creating a new connection reference on the step in the Flow but that hasn't fixed the issue.


Does anyone have any idea on how I can get around this problem?  Or why it has suddenly become a problem?

1 Reply

I believe I have now found a workaround to this issue.  In case it helps anyone else, I found that if I added a SharePoint Get Items step before my first SharePoint REST request step everything worked as expected.