<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div style="font-family:Arial;">Hi,<br></div><div style="font-family:Arial;"><br></div><div style="font-family:Arial;">It's unlikely to be a problem for you, but credential passing via command-line arguments is considered an anti-pattern because they're visible by other users who might be looking at the running process list. Environment variables are better because other users can't inspect them.<br></div><div style="font-family:Arial;"><br></div><div style="font-family:Arial;">Of course, this is arguably even less relevant in today's container/k8s world, and config options are awkward when you need to open multiple datasets from different sources.<br></div><div style="font-family:Arial;"><br></div><div style="font-family:Arial;">Laurentiu<br></div><div style="font-family:Arial;"><br></div><div>On Tue, Oct 29, 2024, at 14:53, Michał Kowalczuk via gdal-dev wrote:<br></div><blockquote type="cite" id="qt" style=""><div dir="ltr"><div>Hi GDAL friends!<br></div><div><div><br></div><div>Why service credentials (username & password) can not be entered with open options (<b>-oo UserPwd=user:pass</b>) when working with OGC services (tested against WMS)?<br></div><div><br></div><div>I know there is a config option <b>GDAL_HTTP_USERPWD=value</b> but it's not clean solution in my opinion. Credential should be related to and owned by the dataset not the global environmental variable. What if I use more than one services that need credentials?<br></div><div><br></div><div>I know there is a "UserPwd" XML tag when using xml as an open path, but this limits the use of other open methods (<a href="https://gdal.org/en/latest/drivers/raster/wms.html#xml-description-file">https://gdal.org/en/latest/drivers/raster/wms.html#xml-description-file</a>).<br></div><div><br></div><div>So, the following returns dataset info<br></div><div><i>gdalinfo "WMS:sample_wms_service?request=getcapabilities&service=wms" <b>--config GDAL_HTTP_USERPWD=user:pass</b></i><br></div><div><br></div><div>and the following:<br></div><div><i>gdalinfo "WMS: sample_wms_service?request=getcapabilities&service=wms" <b>-oo UserPwd=user:pass</b></i><br></div><div>returns error:<br></div><div><i>ERROR 1: HTTP error code : 401<br>ERROR 1: Error returned by server : HTTP error code : 401 (0)<br>gdalinfo failed - unable to open</i> ...</div><div><br></div></div><div>Unfortunately, I can not share the sample service and it's credentials, but it is not needed for answer my general question.<br></div><div><br></div><div>Thank you in advance for your interest in the problem<br></div><div>Michał Kowalczuk<br></div></div><div>_______________________________________________<br></div><div>gdal-dev mailing list<br></div><div><a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br></div><div><a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br></div><div><br></div></blockquote><div style="font-family:Arial;"><br></div></body></html>