<div dir="auto">Hi Bernard,<div dir="auto"><br></div><div dir="auto">Many thanks works perfectly.</div><div dir="auto"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le lun. 14 oct. 2019 à 16:13, Bernhard Ströbl <<a href="mailto:bernhard.stroebl@jena.de">bernhard.stroebl@jena.de</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Denis,<br>
<br>
I use:<br>
uri = QgsDataSourceUri()<br>
uri.setDataSource(schemaName, tableName, geomColumn)<br>
uri.setConnection(thisHostName,<br>
     str(thisPort), thisDatabaseName,<br>
     "", "", QgsDataSourceUri.SslRequire, thisAuthCfgId)<br>
vLayerUri = uri.uri(False)<br>
vlayer = QgsVectorLayer(vLayerUri, displayName, "postgres",<br>
     layerOptions)<br>
<br>
this works as expected storing the authcfg=auth_id using QGIS 3.4<br>
<br>
Bernhard<br>
<br>
Am 14.10.2019 um 15:52 schrieb Denis Rouzaud:<br>
> Hi all,<br>
> <br>
> I add a layer using an authentification config ID using PyQGIS:<br>
> <br>
> uri = QgsDataSourceUri()<br>
> uri.setConnection(HOST, PORT, DB, None, None, <br>
> QgsDataSourceUri.SslPrefer, pg_auth_id)<br>
> <br>
> In the project, the credentials are written in clear text in the project <br>
> file:<br>
> <br>
> <datasource>dbname='pub' host=<a href="http://geodb.rootso.org" rel="noreferrer noreferrer" target="_blank">geodb.rootso.org</a> <<a href="http://geodb.rootso.org" rel="noreferrer noreferrer" target="_blank">http://geodb.rootso.org</a>> <br>
> port=5432 user='xxxxxx' password='xxxxxx'<br>
> <br>
> Is it possible to avoid this? How?<br>
> <br>
> Cheers,<br>
> Denis<br>
> <br>
<br>
<br>
__________ Information from ESET Mail Security, version of virus signature database 20178 (20191014) __________<br>
<br>
The message was checked by ESET Mail Security.<br>
<a href="http://www.eset.com" rel="noreferrer noreferrer" target="_blank">http://www.eset.com</a><br>
<br>
<br>
_______________________________________________<br>
QGIS-Developer mailing list<br>
<a href="mailto:QGIS-Developer@lists.osgeo.org" target="_blank" rel="noreferrer">QGIS-Developer@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a></blockquote></div>