AnsweredAssumed Answered

Access private map in ARCGIS studio without login to arcgis online

Question asked by rajni_sharma on Jul 20, 2020
Latest reply on Jul 22, 2020 by ESoekianto-esristaff

Hi i want to access my maps(private). in my application , but they always ask for the login credentials.

I want to make it accessible without login.

DO I need to add credential of username and password and token,

How to generate token in arcgis to pass in credentials, to access private map without login 

I used this example to write the below code .



This is my code below:-

import QtQuick 2.6
import QtQuick.Controls 2.1
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.1
import QtPositioning 5.3
import QtSensors 5.3
import ArcGIS.AppFramework 1.0
import ArcGIS.AppFramework.Controls 1.0
import Esri.ArcGISRuntime 100.6
import Esri.ArcGISRuntime.Toolkit.Dialogs 100.1
import "assets/js/backend.js" as Backend
    id: app
    width: 400
    height: 800
    property real scaleFactor: AppFramework.displayScaleFactor
    property string portalUrl: "";
    property string itemID: "mymapid"
    //header bar
    Rectangle {
        id: titleRect
        anchors {
            left: parent.left
            right: parent.right
        height: 50 * AppFramework.displayScaleFactor
        color:"titleBackgroundColor", "red")
        Text {
            id: titleText
            anchors.centerIn: parent
            color:"titleTextColor", "white")
            font {
                pointSize: 18
            wrapMode: Text.WrapAtWordBoundaryOrAnywhere
            maximumLineCount: 2
            elide: Text.ElideRight
            horizontalAlignment: Text.AlignHCenter
    }//End Rectangle header
    MapView {
        property real initialMapRotation: 0
        anchors {
            left: parent.left
            right: parent.right
            top: titleRect.bottom
            bottom: parent.bottom
        rotationByPinchingEnabled: true
        zoomByPinchingEnabled: true
    // add a basemap
    Map {
        item: PortalItem {
            portal: portal
            itemId: itemID
        //initUrl: portalUrl + itemID
    }//End Mapview
    //! [PortalUserInfo create portal]
    Portal {
        id: portal
        credential: Credential {
            oAuthClientInfo: OAuthClientInfo {
                oAuthMode: Enums.OAuthModeUser
                clientId: "myclientid" //replace
        Component.onCompleted: {
        onLoadStatusChanged: {
            if (loadStatus === Enums.LoadStatusFailedToLoad)
    AuthenticationView {
        id: authView
        authenticationManager: AuthenticationManager
    //! [PortalUserInfo create portal]