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 https://community.esri.com/message/908803-re-simple-app-with-private-webmap?commentID=908803#comment-908803 .
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
App{ id: app
width: 400
height: 800
property real scaleFactor: AppFramework.displayScaleFactor
property string portalUrl: "https://arcgis.com/sharing/rest/content/items/";
property string itemID: "mymapid"
//header bar
Rectangle { id: titleRect
anchors { left: parent.left
right: parent.right
top: parent.top
}
height: 50 * AppFramework.displayScaleFactor
color: app.info.propertyValue("titleBackgroundColor", "red") Text { id: titleText
anchors.centerIn: parent
text: app.info.title
color: app.info.propertyValue("titleTextColor", "white") font { pointSize: 18
}
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
maximumLineCount: 2
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
}
}//End Rectangle header
MapView { id: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 { id: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: { load();
//fetchLicenseInfo();
}
onLoadStatusChanged: { if (loadStatus === Enums.LoadStatusFailedToLoad)
retryLoad();
}
}
AuthenticationView { id: authView
authenticationManager: AuthenticationManager
}
//! [PortalUserInfo create portal]
}