GithubHelp home page GithubHelp logo

OAuth2 for Layer in ArcMap about arcrest HOT 3 CLOSED

esri avatar esri commented on June 19, 2024
OAuth2 for Layer in ArcMap

from arcrest.

Comments (3)

achapkowski avatar achapkowski commented on June 19, 2024

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.

from arcrest.

achapkowski avatar achapkowski commented on June 19, 2024

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"}"""
result = mapping.ConvertWebMapToMapDocument(text)
mxd = result.mapDocument
mxd.saveACopy(r"c:\temp\sometokentest.mxd")

from arcrest.

DShokes avatar DShokes commented on June 19, 2024

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!

from arcrest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.