Select to view content in your preferred language

invalid token 498 returned for generateToken

948
2
Jump to solution
04-21-2022 12:15 PM
KellyChan
New Contributor III

I'm using www.arcgis.com/sharing/generatetoken to obtain access tokens for query. Some of my services work, but others failed with "498, Invalid Token". The failed services are, by-and-large, backing store for Survey123.

I tried both generateToken, and generateToken (with serverURL.)

  1. I'm using ArcGIS Identity (username/password) to generate tokens.
  2. I do not own the Survey123; they are shared with me.
  3. Do I really need server token on ArcGIS Online? My service is
    1. https://services.arcgis.com/04H.../arcgis/rest/services/service_...e736/FeatureServer/
    2. what is the proper sequence of calls
    3. any code snippets / examples would be appreciated 

 

Thanks in advance.

PS. I'm able to access using OAuth token. So not completely dead in the water. But do want to know restrictions/limitations vis-a-vis generateToken.

0 Kudos
1 Solution

Accepted Solutions
AnthonyRyanEQL
Regular Contributor

Kelly,

How does the body of the request look when you're trying to generate the token

I'm using PowerShell to generate a token from AGOL and find content that is only shared to me which is working great for me

 

$body = @{
username="builtin username goes here"
password="builtin username password goes here"
expiration=60
referer="https://energyq.maps.arcgis.com"
f="json"
}
$LoginResponse = Invoke-WebRequest -Uri "https://www.arcgis.com/sharing/generateToken" -Body $body -Method "POST"

View solution in original post

0 Kudos
2 Replies
AnthonyRyanEQL
Regular Contributor

Kelly,

How does the body of the request look when you're trying to generate the token

I'm using PowerShell to generate a token from AGOL and find content that is only shared to me which is working great for me

 

$body = @{
username="builtin username goes here"
password="builtin username password goes here"
expiration=60
referer="https://energyq.maps.arcgis.com"
f="json"
}
$LoginResponse = Invoke-WebRequest -Uri "https://www.arcgis.com/sharing/generateToken" -Body $body -Method "POST"

0 Kudos
KellyChan
New Contributor III

thanks @AnthonyRyanEQL. but possibly needs some expert advises from Esri. it took us quite a bit. oh well. lessons learnt

  • we are doing an azure function, so there is no "referer". & I'm successful with sending any garbage referer URL
  • we thought would be proper to use client=requestip but that's probably obfuscated somewhat, thus failed with "invalid token" perhaps.
  • there isn't a static ip (unless we pay dearly to microsoft)