0

I am currently working on an Android application that utilizes the Esri Maps SDK. In my application, I need to pass a custom authentication token along with the service feature request to the server. However, I initially encountered an error while attempting to pass the auth token using the credential method.

Here is the current Android implementation code:

val serviceUrl = "service_url"
val authToken = "auth_token"

with(ServiceFeatureTable(serviceUrl)) {
    val credential = UserCredential.createFromToken(
        authToken,
        "dummy_referer"
    )
    this.credential = credential

    // Define the request mode to manual
    featureRequestMode =
        ServiceFeatureTable.FeatureRequestMode.MANUAL_CACHE

    // Load the ServiceFeatureTable and set it as the feature layer's data source
    addDoneLoadingListener {
        if (loadStatus == LoadStatus.LOADED) {
            // Query time extent
            queryTimeExtent(this, completionCallback, startTimeMilli, endTimeMilli)
        } else {
            completionCallback?.onError(loadError)
        }
    }

    trackFeatureLayer = FeatureLayer(this).apply {
        id = "user_map"

        addDoneLoadingListener {
            if (loadStatus == LoadStatus.LOADED) {
                /*  mapView?.setViewpointAsync(Viewpoint(fullExtent))
                            completionCallback?.onSuccess(visible)*/
            } else {
                completionCallback?.onError(loadError)
            }
        }

        // add the feature layer to the map's operational layers
        mapView?.map?.operationalLayers?.add(this)
    }
}

When I send the request using the iOS SDK, I can successfully include the authentication token, and the server receives it as expected. However, when I attempt to send the same token using the Android SDK, the received request on the server side does not include the token.

I have already ensured that I'm correctly passing the authentication token using credentials without encountering any errors. The issue seems to be specific to the Android SDK.

I have also posted a question on the Esri Community forum regarding this issue, which can be found at link to the Esri Community question.

Is there any solution or workaround available to successfully pass the custom authentication token with the service feature request using the Android SDK? Any guidance or insights would be greatly appreciated.

Vipul Purohit
  • 9,807
  • 6
  • 53
  • 76

0 Answers0