Select to view content in your preferred language

Authentication issue - clientid "requestip" vs client "requestip"

406
0
07-09-2021 02:14 PM
AndrewMurdoch1
Frequent Contributor

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

0 Kudos
0 Replies