[QGIS-Developer] Question on QGIS Authentication API

C Hamilton adenaculture at gmail.com
Mon Feb 3 06:36:05 PST 2020


John,

Thanks for that hint. Here is what I finally used.

auth_mgr = QgsApplication.authManager()
conf_map = auth_mgr.availableAuthMethodConfigs()
for key in conf_map.keys():
    name = conf_map[key].name()
    print( key )
    print( name )

So that gives me both the authentication id and its name. Thanks so much.

Calvin

On Mon, Feb 3, 2020 at 6:24 AM John Gitau <gkahiu at gmail.com> wrote:

> Hi Calvin,
>
> You can retrieve the name from the base config object as follows:
>
> auth_mgr = QgsApplication.authManager()
> conf_map = auth_mgr.availableAuthMethodConfigs()
> for id, conf in conf_map.iteritems():
>     conf_name = conf.name()
>     print conf_name
>
> I hope this helps.
>
> Cheers,
>
> John
>
> On Fri, Jan 31, 2020 at 11:11 PM C Hamilton <adenaculture at gmail.com>
> wrote:
>
>> I can get a list of all of the authentication IDs in QGIS by these two
>> lines of code.
>>
>> authMgr = QgsApplication.authManager()
>> authIdList = authMgr.configIds()
>>
>> Starting from one of the authentication ids in the list I cannot seem to
>> find out how to retrieve its associated name. It is probably simple, but I
>> cannot find the right method to call. Does anyone know how to do it?
>>
>> Thanks,
>>
>> Calvin
>> _______________________________________________
>> QGIS-Developer mailing list
>> QGIS-Developer at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200203/9adb48d7/attachment.html>


More information about the QGIS-Developer mailing list