Select to view content in your preferred language

Validate token usings portal /self

157
0
07-27-2024 02:28 PM
GerardoSevilla
Emerging Contributor

I read on the following post https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/rest-api-is-there-a-way-to-val... you could use your https://developers.arcgis.com/rest/users-groups-and-items/portal-self/ to validate a token and I can verified it could be used with the browser and postman to validate a token. Still I cannot manage to make it work either using javascript's fetch or jquery's ajax functions. It returns invalid token even though it is valid using the browser. Can anyone help me with this? Thanks in advance.

example:

fetch('.../sharing/rest/portals/self?f=json&token=' + token,{
    method: 'GET'
}).then(...).catch( ....);

always returns

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

0 Replies