Just a quick tip,
Background:
I was working on Power automate, and after a while i found this “Could not find any valid connection for connection reference name ‘shared_office365_1’ in APIM tokens header.” error, when testing it, though it is successfully saving.
Solution:
Kindly export the flow, choose the .zip option to export. and import it back. This should work.