I am afraid currently this is not achieveable, specially for the Custom API part.
The Authentication need to be configured when creating the Custom Connection, which means the connection should be created before the Custom API could be used in Microsoft Flow.
In your scenario, the full scenario should be:
1. Create PowerApps,
2. Create Microsoft Flow with Custom API connection,
3.Launch PowerApps, then enter username and password
4. Pass the Basic-authenticate information through Microsoft Flow
5. Authenticate the Custom API
6. Get Response within MS Flow,
7. Return the response back to PowerApps,
The issue I mentioned should happen at step 2 (also Step 4 and step 5).
Flow would need the authentication information before adding the custom API connection under edit mode, once finished, there is no need to deal with the authentication information for the Custom API,
Currently there is no proper way to configure the authentication used within Microsoft Flow:
There is an idea submitted on the same topic, see:
Change original owner of a flow
You may also rise your own idea if this one does not meet your scenario.
Regards,
Michael