"{"error": { "code": 498, "message": "Invalid token."}

2669
2
Jump to solution
01-02-2022 07:31 AM
naveenbesri
Frequent Contributor

Hi All,

When i try to get arcgis portal users with below rest url in the code level. Im getting below error

function _verifyUserRole(username, token) { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = () =>{ if(xhttp.readyState == XMLHttpRequest.DONE) { var jsonResponse = JSON.parse(xhttp.responseText); } }; xhttp.open("GET", "https://domainname/portal/sharing/rest/portals/0123456789ABCDEF/users?username="+username+"&f=pjson&referer=https://domainname&token=" + token, true);
xhttp.send(); }
 

"{"error": { "code": 498, "message": "Invalid token.", "details": [] }}"

But when i try to access the same url in the browser im getting response. 

 

Could you please help me on this. 

Thanks.

1 Solution

Accepted Solutions
ABishop
MVP Regular Contributor

Not sure about why you are receiving this error, but I looked up the error code and I got this thread:

https://community.esri.com/t5/arcgis-api-for-python-questions/error-code-498-message-invalid-token/t... 

Amanda Bishop, GISP

View solution in original post

2 Replies
ABishop
MVP Regular Contributor

Not sure about why you are receiving this error, but I looked up the error code and I got this thread:

https://community.esri.com/t5/arcgis-api-for-python-questions/error-code-498-message-invalid-token/t... 

Amanda Bishop, GISP
samten-qps
New Contributor

Hi Naveen, 

I had the similar issue as yours and i managed to resolve it by using the pulldata("@javascript", "functions.js", "ReplaceWithYourFunctionName", pulldata("@property", 'token'), ${u_name}) in the XLS form which runs the JS function with the supplied token and username arguments. If you are using another method to extract and supply these parameters to your JS function, it would not work and hence throw the above invalid token error. 

I hope that helps if you are still looking for a solution.

 

0 Kudos