I am using AppStudio to build an application that uses secured feature services. I declared a Feature Layer and a ServiceFeatureTable as shown below. I am passing the token in the credential.token property. The features donot show up on the map. If I paste the feature layer url followed by the token in a browser, I can see the feature layer details. What am I doing wrong in the example shown below
import QtQuick 2.7
import QtQuick.Controls 2.1
import QtQuick.Controls.Styles 1.4
import QtQuick.Controls.Material 2.1
import ArcGIS.AppFramework 1.0
import ArcGIS.AppFramework.Controls 1.0
import Esri.ArcGISRuntime 100.1
Item {
property real scaleFactor: AppFramework.displayScaleFactor
// Map view UI presentation at top
MapView {
id: mv
anchors.fill: parent
Credential {
id : cred
token : "dhCmM1r-nHjlh6-d-EeMlUqiGVlOIL91NoVRF6eIQO9oXEoL7X2IJ0riZBMMlOQPcZbOP4pmkdGwoL96grvcZ5pfS1BXcFJjReuNYYCyG0qF0FfpfueRRK8jSvoDz0UbDa7nb48-czOdg8fyqKaE0a6hFm_RFhlxphfDV7ldKbBWQTN9R0Zhnct-6Trqnzx6WnFv_fv8QbSLTaZc7IDaTTJWFPMBt8RS8HIlQivAKKInws7ZF-ZMxNvZ6l9NFJo3xv38arV51LJkfMcHcA137Q.."
}
//! [Display Feature Service]
Map {
BasemapTerrainWithLabels {}
initialViewpoint: vc
FeatureLayer {
id: serviceBackedFeatureLayer
popupEnabled: true
PopupDefinition {
fields: featureTable.fields
}
ServiceFeatureTable {
id:featureTable
url: "https://services9.arcgis.com/w5LjzOecXeZ5ftNR/arcgis/rest/services/Storm_Inlet/FeatureServer/0"
credential : cred
}
}
}
//! [Display Feature Service]
ViewpointCenter {
id: vc
center: Point {
x: -13176752
y: 4090404
spatialReference: SpatialReference {
wkid: 102100
}
}
targetScale: 300000
}
// Busy Indicator
BusyIndicator {
anchors.centerIn: parent
height: 48 * scaleFactor
width: height
running: true
Material.accent:"#8f499c"
visible: (mv.drawStatus === Enums.DrawStatusInProgress)
}
}
}
Instead of Token, can you use username and password.
Credential QML Type | ArcGIS for Developers
If you wanna avoid username and password. You could do that using oAuthClientInfo by using clientId and clientSecret approach
OAuthClientInfo QML Type | ArcGIS for Developers
Nakul