I'm attempting to add a relationship between two items in a hosted feature layer via the addToDefinition command in a script. I have the correct JSON, and I can apply it myself via the Rest directory of the feature layer. When I try and run it from ArcGIS Pro, passing my pro credentials to the script:
gis = GIS('pro')
and using the:
token = gis._con.token
command it doesn't work. If I hardcode my username and password into the script instead:
gis = GIS("https://www.arcgis.com", username, password) it does work...every time!
What is the difference between the two methods? It's the same account, so surely the token it generates to make the change will be identical. I would rather not have to hardcode a username and password in and have it just inherit Pro's connection properties. I also tried using the:
arcpy.GetSigninToken() command, but again it doesn't work when I pass this as the token
Any help is much appreciated