Generate Token in WAB for Layer
In Geocortex I'm able to use "Get Layer" (passing the the sub layer id) followed by the parse URL ($X.layer.url) for example. This will provide me with a token to query the layer in later tasks.
However I'm working with a layer stored in ArcGIS Online and it's through WAB so it's a bit different. I was able to "Get Layer" by passing in the name but the parse URL doesn't work it just returns null. So I'm just not sure how to get a token for that layer. Any assistance would be greatly appreciated!
-
Hi Shawn,
I'm not certain if it'll be the same for every layer, but I found I could get a token out of my WAB layers by going to the credential property from the Get Layer activity's output, instead of the url property:
=$layer1.layer.credential.token
0 -
I am unable to get token from using this method $layer1.layer.credential.token
or $parseUrl.query["token"]method.
Is that something I am missing? Does the map has to be configured to return the token?
0 -
Hello Shawn,
Struggling with a similar issue, I found this thread. I found two possible solutions. Even though I am working for a deployment in Geocortex Viewer for HTML5 to update features in a secured feature layer, it may help you or others as well.
Option 1: get token from layer URL
You could use the following steps in Workflow 5 to get the token. Your URL would like something like ?token=, so where the =-mark is, we can split the string.
- Insert a Get Layer activity and point it to the correct layer id (either string from a web map or a numeric ID from a HTML5 viewer).
- Insert a Create Value activity with an expression like the following. In my case, I named the activity 'tokenArray'. Expression: =$layer1.layer.url.split('=')
- Insert another Create Value activity with an expression like the following. Expression: =$tokenArray.result[1]
You could log the result.
Option 2: use the Layer input in a Query Task instead of the URL input
Another option would be the following.
- Insert a Get Layer activity and point it to the correct layer id (either string from a web map or a numeric ID from a HTML5 viewer).
- Insert a Query Task activity. Instead of using the URL input, you could use the Layer input using $layer1.layer from the previous Get Layer activity.
Does this help?
0
Please sign in to leave a comment.
Comments
3 comments