Token Required - Error 499: When Attempting to Query Feature Layer (Arcgis 1.8.2)
See original GitHub issueHello - please see below:
from arcgis.gis import GIS
gis = GIS("https://portalname.domain.com/webadapter_name",
client_id='1234_sample_client_id',
verify_cert=False)
This successfully opens up a browser and I login with IWA…
print("Successfully logged in as: " + gis.properties.user.username)
This returns a success message and I am able to explore my content in the Portal
l = gis.content.get('1234567_item_sample_id')
fl = l.layers[0]
I am able to get content (that is not shared/public) and use methods such as l.get_data()
fl.query(where="1=1")
This is where the failure occurs, and I am given an Exception “Token Required (Error Code: 499”
Full failure below:
File "<ipython-input-9-e7d33acb2760>", line 3, in <module>
fl.query(where="1=1")
File "C:\*****************\Anaconda3\lib\site-packages\arcgis\features\layer.py", line 1048, in query
record_count = self._query(url, params, raw=as_raw)
File "C:\*****************\Anaconda3\lib\site-packages\arcgis\features\layer.py", line 2048, in _query
raise queryException
File "C:\*****************\Anaconda3\lib\site-packages\arcgis\features\layer.py", line 2018, in _query
postdata=params, token=self._token)
File "C:\*****************\Anaconda3\lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 710, in post
force_bytes=kwargs.pop('force_bytes', False))
File "C:\*****************\Anaconda3\lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 505, in _handle_response
self._handle_json_error(data['error'], errorcode)
File "C:\*****************\Anaconda3\lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 523, in _handle_json_error
raise Exception(errormessage)
Exception: Token Required
(Error Code: 499)
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (5 by maintainers)
Top Results From Across the Web
Error: Authentication token required. (status code 499)
The error occurs when the layers are added from a previous project, for example, the layer is opened through ArcGIS Online by selecting...
Read more >Query (Feature Service/Layer)—ArcGIS REST APIs
The query operation returns either a feature set, an array of feature IDs, and/or a result extent.
Read more >Authentication Error 499 using ArcGIS API for Python?
token = gis._con.token print(token). But If I try to create a FeatureLayer and search, I get an authentication error (499):
Read more >c# - How to generate a token to query a REST ArcGIS service?
This service is a private one and requires token-based authentication to access the data within the service. Since I am new to ArcGIS,...
Read more >Esri ArcGIS Feature Service Reader - FME Community
i'm attempting to use Esri ArcGIS Feature Service Reader and it is secured in fme 2018.1 it gives me this error (This may...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve been experiencing the same issue with arcgis version 1.8.x. Digging through the code, it appears that several
FeatureLayer
methods, such asquery
, issue a call to aConnection
object’spost
method, which requires a token to be specified. All those calls set the token parameter toself._token
; however,_token
is apparently not being set for aFeatureLayer
object. The token does exist in theFeatureLayer
’sConnection
attribute (ie.self._con.token
). I’m able to monkey patchFeatureLayer
by adding a property that returns the token:Querying then works properly.
@rodrigoalmeida94 thank you for letting us know about your issues and please continue to let us know if you encounter anything.