Hey everyone,
so in our APP we use a Portal login for Authentification, I add the used Code below. I noticed that when creating a new FeatureLayer a Request to /server/rest/services/03/xx/FeatureServer/2?f=json gets sent with response {"error":{"code":499,"message":"Token Required","details":[]}}, it automatically resends that request with token than it works. I'd like to savemyself all these requests and include the token on start.
Does anybody have a Idea how to accomplish that?
I tried setting up a interceptor with
before FeatureLayer Creation.
I added the token via the customParameter property while creating the featureLayer.
What seemed to work at first, was setting the token in the apiKey property while initializing the FeatureLayer, however after the token had to be refreshed, the client didn't change to the new token.
Any Idea would be appreciated, thanks 🙂
Have you tried using the registerToken method of the IdentityManager module? I've used it to do this same kind of thing.
For example:
esriId.registerToken({
expires: tokenResponse.expires,
server: "https://myServer/arcgis/rest/services",
token: tokenResponse.token
});
Only using the registerToken() after signIn dosn't work.
However If I do this
IdentityManager.credentials[1].resources.push(layerConfig.url);