I am developing QGIS Python plugin. I have a QGIS project and layers stored in a PostGIS database. I don't want to store the password into the project and I want to avoid that user need to type credentials, and also I want to avoid storing the credentials permanently.
When I open the project, I'm immediately prompted for credentials before any layers from the db are rendered.
Is there any way to enter db credentials(password and username) or set datasource programmatically before dialog is shown?
I want avoid this dialog to be shown: