[qgis-qwc2] Redirect to login page for unauthenticated users

Benjamin Cahill bcahill at alertacademy.com
Thu May 1 08:48:39 PDT 2025


Hello,

Is there a way to redirect users that are not logged in to the login page?

I found the "auth_required" option documented on the following page:
https://qwc-services.github.io/master/references/qwc-map-viewer/

But even after adding it to tenantConfig.json and re-generating the
config, it still does not redirect a new unauthenticated user (fresh
incognito window) to the login page.

      "name": "mapViewer",
      "generator_config": {
        "qwc2_config": {
          "qwc2_config_file": "/srv/qwc_service/config-in/default/config.json",
          "qwc2_index_file": "/srv/qwc_service/config-in/default/index.html"
        }
      },
      "config": {
        "qwc2_path": "/qwc2/",
        "auth_service_url": "/ldap/",
        "data_service_url": "/api/v1/data/",
        "#document_service_url": "/api/v1/document/",
        "elevation_service_url": "/elevation/",
        "info_service_url": "/api/v1/featureinfo/",
        "legend_service_url": "/api/v1/legend/",
        "mapinfo_service_url": "/api/v1/mapinfo/",
        "ogc_service_url": "/ows/",
        "permalink_service_url": "/api/v1/permalink/",
        "#print_service_url": "/api/v1/print/",
        "search_service_url": "/api/v2/search/",
        "search_data_service_url": "/api/v2/search/geom/",
        "auth_required": true

I did try forcing a redirect from my webserver config by checking for
an access_token_cookie cookie, but that introduced other problems.

Does anyone know how to get the auth_required option to redirect
unauthenticated users to the login page?

Thank you,

 - Benjamin


More information about the qgis-qwc2 mailing list