Skip To Content ArcGIS for Developers Sign In Dashboard

ArcGIS Runtime SDK for Qt

Token authentication

Sample Viewer View Sample on GitHub

Access a web map that is secured with ArcGIS token-based authentication.

Use case

Allows you to access a secure service with the convenience and security of ArcGIS token-based authentication. For example, rather than providing a user name and password every time you want to access a secure service, you only provide those creditials initially to obtain a token which then can be used to access secured resources.

How to use the sample

Once you launch the app, you will be challenged for an ArcGIS Online login to view the protected map service. Enter a user name and password for this resources. In this case, the username is user1 and the password is also user1.

How it works

  1. Create an ArcGISMapImageLayer passing in the URL to a map service that is secured with token-based authentication.
  2. Append the map image layer to the operational layers to display the map.

Relevant API

  • Map
  • MapView
  • ArcGISMapImageLayer


authentication, cloud, portal, remember, security

Sample Code

import QtQuick 2.6
import QtQuick.Controls 2.2
import Esri.ArcGISRuntime 100.9
import Esri.ArcGISRuntime.Toolkit.Dialogs 100.9

Rectangle {
    id: rootRectangle
    clip: true
    width: 800
    height: 600


    MapView {
        id: mapView
        anchors.fill: parent

        Map {
            id: map
            BasemapTopographic {}

            ViewpointExtent {
                Envelope {
                    json: {"spatialReference":{"latestWkid":3857,"wkid":102100},

        Column {
            anchors {
                horizontalCenter: parent.horizontalCenter
                bottom: mapView.attributionTop
                margins: 10
            spacing: 10

            Text {
                anchors.horizontalCenter: parent.horizontalCenter
                font.pixelSize: 14
                text: "username/password: user1/user1"

            Button {
                anchors.horizontalCenter: parent.horizontalCenter
                text: "Load Secured Layer"
                onClicked: map.operationalLayers.append(mapImagelayer);

    // add a map service that is secured with token-based authentication
    // username/password is user1/user1
    ArcGISMapImageLayer {
        id: mapImagelayer
        url: ""

    // Uncomment this section when running as standalone application

    // Declare an AuthenticationView
    AuthenticationView {
        anchors.fill: parent
        authenticationManager: AuthenticationManager // set the authenticationManager property