Skip to main content

Generate Token in WAB for Layer

Comments

3 comments

  • Permanently deleted user

    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
  • Jenny Oh

    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
  • Permanently deleted user

    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.

    1. 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).
    2. Insert a Create Value activity with an expression like the following. In my case, I named the activity 'tokenArray'. Expression: =$layer1.layer.url.split('=')
    3.  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.

    1. 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).
    2. 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.