Login to ArcGIS online using .arcgisprofile keeps asking to delete profile since it is v1.3 format

1297
2
10-19-2020 01:06 PM
JadeWeideman
New Contributor II
This thread (started by Maaza Mekuria) was posted in ArcGIS Survey123 but is more relevant in ArcGIS API for Python. Copied and pasted here.    Anyone else experiencing this?
Maaza Mekuria asked7 months ago

I am wondering why from time to time that the login into ArcGIS using a profile keeps asking to delete it since it "appears to be in the <v1.3 format....  . This is not nice, I did not ask it to be v1.3.  Infact when the profile script is run, it says it is version 7.4!  I upgraded to 1.8 and now I turned back to 1.6.2 . What is wrong here?

Please see the image below and help me figure out what version it is talking about.  The API version 1.6+ the ArcPro installed is 2.4.3 and I have updated python 3.6 (it is the compatible version for ArcPro) . 

I use a script to set the profile as detailed in using authenticated profiles. Working with different authentication schemes | ArcGIS for Developers  

Why is this error coming up?

I am experiencing the same issue.

 

Our client only has ArcGIS Online, no ArcGIS Pro or access to ArcPy (only ArcGIS API for Python) and long story short, I wrote a Python script that does basic ETL processes (gets data from their API, transforms and loads it into a Hosted Feature Layer in their AGOL account). I followed the approach here to set up a .arcgisprofile persisted profile for saving the credentials to their AGOL account on the local machine in windows credentials manager: 

 

  • To create the profile using Python (once off): 

gis = GIS(url="https://arcgis.com", username="something", password="something", profile="AGOL_prof"')

  • For the script to use the profile from then on onwards: 
gis = GIS(profile="AGOL_prof")

 

It worked fine for a few weeks, the python script was scheduled and the layer in AGOL was updated regularly with new data like it should.
After a windows update one night, we realised the layer wasn't being updated anymore and I saw this when I tried to run the script using Command Prompt:

I had to delete the profile and create it again. It worked for a day and then the same thing happened again. 
Jade
Tags (1)
0 Kudos
2 Replies
MaazaMekuria
Occasional Contributor

Still experiencing the same thing again and again.  It is frustrating to not have someway of mitigating this problem!  I never created a v1.3 format in the first place.  But deleting and recreating the profile will work for an undetermined amount of time and then comes the hangup!  Any help is much appreciated. 

0 Kudos
mramiah
New Contributor

Hope this is still useful. As a workaround, you can bypass the profile file and  retrieve the credentials from the Windows Credential Manager. When you create a profile using:

 

gis = GIS(url="https://xyz.maps.arcgis.com", username="username", password="password", profile="my_profile")

 

 a corresponding generic credential is created in the windows credential manager with the profile value as the user name. The Internet or network address for the credential will be in the format of profile@arcgis_python_api_profile_passwords:

mramiah_0-1628801415671.png

You can use keyring to retrieve the stored password and connect to your org:

 

import keyring
from arcgis.gis import GIS
profile = "my_profile"
network_addr=f"{profile}@arcgis_python_api_profile_passwords"
pwd = keyring.get_password(network_addr, profile)
gis = GIS(url=<agol_url>, username=<agol_user>, password=pwd)