Select to view content in your preferred language

A general error occurred when authenticating to ArcGIS via Python using username/password

804
1
Jump to solution
11-10-2023 12:50 AM
PanjiBrotoisworo2
New Contributor III

Hi guys,

I'm starting to encounter this error all of a sudden when trying to authenticate to ArcGIS Online using my username and password. This has worked before in other instances but all of a sudden it started raising this cryptic error. Does anyone have any ideas on what's going on?

The credentials should still be active. I haven't changed them since the last time I used this script.

 

 

gis = GIS(url=r"https://xxxx.maps.arcgis.com/", username="xxxx", password="xxxx")

 

 I get this error:

 

---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
d:\conda_envs\arcgis\lib\site-packages\arcgis\auth\_auth\_token.py in token(self)
840 if self._response_type == "token":
--> 841 self._init_response_type_token()
842 else:

d:\conda_envs\arcgis\lib\site-packages\arcgis\auth\_auth\_token.py in _init_response_type_token(self)
581 # Now we extract the token from the URL to make use of it.
--> 582 self._auth_token = session.token_from_fragment(callback_url)
583 if "expires_at" in self._auth_token:

d:\conda_envs\arcgis\lib\site-packages\requests_oauthlib\oauth2_session.py in token_from_fragment(self, authorization_response)
370 """
--> 371 self._client.parse_request_uri_response(
372 authorization_response, state=self._state

d:\conda_envs\arcgis\lib\site-packages\oauthlib\oauth2\rfc6749\clients\mobile_application.py in parse_request_uri_response(self, uri, state, scope)
171 scope = self.scope if scope is None else scope
--> 172 self.token = parse_implicit_response(uri, state=state, scope=scope)
173 self.populate_token_attributes(self.token)

d:\conda_envs\arcgis\lib\site-packages\oauthlib\oauth2\rfc6749\parameters.py in parse_implicit_response(uri, state, scope)
350 if state and params.get('state', None) != state:
--> 351 raise ValueError("Mismatching or missing state in params.")
...
-> 1515 raise Exception("A general error occurred: %s" % e)
1516 except:
1517 import traceback

Exception: A general error occurred: list index out of range

 

0 Kudos
1 Solution

Accepted Solutions
PanjiBrotoisworo2
New Contributor III

Just an update.

API started working again after I changed my password due to an expired password. That might have had something to do with this error since my password was expired but my old password was still "valid" in some way because I did not set a new password at the time.

View solution in original post

0 Kudos
1 Reply
PanjiBrotoisworo2
New Contributor III

Just an update.

API started working again after I changed my password due to an expired password. That might have had something to do with this error since my password was expired but my old password was still "valid" in some way because I did not set a new password at the time.

0 Kudos