Select to view content in your preferred language

Feature service Token

425
1
Jump to solution
09-11-2022 01:17 AM
Guy_srb
Regular Contributor

Hi!

I have a problem using a secured feature service.

  esriConfig.request.interceptors.push({
    urls: FeatureLayerURL,
    before: function(params) {
      params.requestOptions.query = params.requestOptions.query || {};
      params.requestOptions.query.token = token;
    },
  });

 

the code does work until I try to Edit features(using EditorViewModel) and then the portal login screen popup appear.

0 Kudos
1 Solution

Accepted Solutions
Guy_srb
Regular Contributor

Found a  better solution, I used this code:

 

  esriId.registerToken({
    server: FeatureLayerURL,
    token: token
  })

 

esriID is from the library "esri/identity/IdentityManager"

View solution in original post

0 Kudos
1 Reply
Guy_srb
Regular Contributor

Found a  better solution, I used this code:

 

  esriId.registerToken({
    server: FeatureLayerURL,
    token: token
  })

 

esriID is from the library "esri/identity/IdentityManager"

0 Kudos