-
Notifications
You must be signed in to change notification settings - Fork 154
OAuth2 for Layer in ArcMap #48
Comments
Though this is not an ArcREST issue, you can try the following workflow (I have not tested this). Using the WebMap JSON, create a map document and an operational layer. On the operational layer url, include the token (?token=) and I think that will solve your issue. Hope this helps. |
Just an FYI, I just took the JSON from one of the samples is the REST API: Here is a working sample that worked for me: text = """{"operationalLayers":[{"url":"?token=< TOKEN>","id":"STATES_OUTLINE_717","visibility":true,"opacity":0.78,"mode":1,"title":"States Outline","layerDefinition":{"drawingInfo":{"renderer":{"type":"simple","symbol":{"color":[108,151,203,0],"outline":{"color":[108,151,203,255],"width":2,"type":"esriSLS","style":"esriSLSSolid"},"type":"esriSFS","style":"esriSFSSolid"}}},"minScale":500000000,"maxScale":0},"popupInfo":{"title":"Offset from UTC: {ZONE}","fieldInfos":[{"fieldName":"ObjectID","label":"ObjectID","isEditable":false,"tooltip":"","visible":false,"stringFieldOption":"textbox"},{"fieldName":"Shape","label":"Shape","isEditable":false,"tooltip":"","visible":false,"stringFieldOption":"textbox"},{"fieldName":"ZONE","label":"Time Zone","isEditable":false,"tooltip":"","visible":false,"format":{"places":2,"digitSeparator":true},"stringFieldOption":"textbox"},{"fieldName":"SQ_MI","label":"SQ_MI","isEditable":false,"tooltip":"","visible":false,"format":{"places":2,"digitSeparator":true},"stringFieldOption":"textbox"},{"fieldName":"SQKM","label":"SQKM","isEditable":false,"tooltip":"","visible":false,"format":{"places":2,"digitSeparator":true},"stringFieldOption":"textbox"},{"fieldName":"COLORMAP","label":"COLORMAP","isEditable":false,"tooltip":"","visible":false,"format":{"places":2,"digitSeparator":true},"stringFieldOption":"textbox"}],"description":null,"showAttachments":true,"mediaInfos":[]}}],"baseMap":{"baseMapLayers":[{"id":"World_Light_Gray_Base_7739","opacity":1,"visibility":true,"url":"http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer"},{"id":"World_Light_Gray_Reference_241","isReference":true,"opacity":1,"visibility":true,"url":"http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Reference/MapServer"}],"title":"Light Gray Canvas"},"version":"1.6"}""" |
Great advice. In the end, I added OAuthSecurityHandler(client_id=,secret_id=) to the begining of the script and the credential popup stopped appearing. Not 100% this was what fixed it, but I'm not touching it while its working! |
Is there an example of how to pass signin credentials for arcmap?
My script makes pdf export from feature services in an mxd. Currently, I must manually sign in on the arcmap credentials popup and keep an instance of ArcMap open. Otherwise, my script fails. I'm currently using AGOLSecurityHandler for other purposes but I'm not sure where to put OAuthSecurityHandler when opening an mxd. I've got a client_id and client_secret made already.
The text was updated successfully, but these errors were encountered: