Good Day
I wrote a function that grabs a token from an authentication URL, which requires the "client" field in the params. When we use client: 'referer', and then set referer, we get a token, and can use that token to authenticate against the feature layer.
If we try to use client: 'requestip' or client: 'ip', and then use the token we get back, we get a FEDERATION error, BUT, if we change client to clientid and set 'requestip' or 'ip', the token that comes back is just fine. I swore I read about this somewhere but can't find it, and I can't explain why this is happening.
This is the query function that also handles authentication.
query(url?: string) {
return new Promise( (r, j) => {
const tokenParams = {
username: this._session.username,
password: this._session.password,
clientid: 'requestip',
}
request(this._tokenURL, {params: tokenParams}).then((esriResponse) => {
request(this.testURL, {params: {token: esriResponse.token}}).then((response) => {
this._featureLayer = _.cloneDeep(response);
r(this._featureLayer.fields);
}).catch((error) => {
console.log('Error');
console.log(error);
j(error);
});
});
});
}
You can see tokenParams is set with clientid: 'requestip', and this works, so does anyone know why?
Thanks