Hi,
I need to add feature layer to a map.
My code:
Problem 1: TypeScript returns the following error: "'token' does not exist in type 'FeatureLayerProperties'." I checked the type definition @types/arcgis-js-api@4.7.0, it is not defined, but 'token' exists in the documentation: FeatureLayer | API Reference | ArcGIS API for JavaScript 4.7
Ok, I added type for 'token' on my own, but then we have problem 2...
Problem 2: The 'token' will not be sendt to the server. So I get a login dialog to be authenticated.
My question is how to add a featureLayer to the map by using token?
According to the doc the recommended approach is to use IdentityManager.registerToken()
FeatureLayer | API Reference | ArcGIS API for JavaScript 4.7
Also take a look at the Application logins section of the 'Access Secure Resources' guide topic for details on using a proxy.
Thank you, Kelly!!!
I did as you suggested. Added IdentityManager at the start of the app and the token was sent to the server when it needed.
But I still wondering why you have "token" as String in the documentation? It did not work for me. It is not even defined in types (typescript) for 4.7. Is IdentityManager only way it works?