<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: FeatureService WorkspaceConnectionString with Portal Token in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/featureservice-workspaceconnectionstring-with/m-p/1330339#M10422</link>
    <description>&lt;P&gt;hi marco, can u try something like this:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var lyr_params = new LayerCreationParams(....) {
  ServiceCustomParameters = new Dictionary&amp;lt;string, string&amp;gt;(){
    {"TOKENPROVIDERTYPE","1234567890abcdefgh...etc...."}
  }
};&lt;/LI-CODE&gt;&lt;P&gt;the dictionary can be any set of (string, string) key/value pairs fyi&lt;/P&gt;</description>
    <pubDate>Tue, 19 Sep 2023 18:58:28 GMT</pubDate>
    <dc:creator>CharlesMacleod</dc:creator>
    <dc:date>2023-09-19T18:58:28Z</dc:date>
    <item>
      <title>FeatureService WorkspaceConnectionString with Portal Token</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/featureservice-workspaceconnectionstring-with/m-p/1330029#M10415</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;I am currently searching for advise on how to provide a portal token within a feature service workspaceConnectionString.&lt;/P&gt;&lt;P&gt;Within the ExportWebMapSpecification there is the possibility to directly insert a token on a layer basis&lt;/P&gt;&lt;P&gt;in order to access secured feature services:&lt;/P&gt;&lt;PRE&gt;"operationalLayers":[&lt;BR /&gt; {&lt;BR /&gt;   "id":"&amp;lt;webmapOperationalLayerId&amp;gt;",&lt;BR /&gt;   "url":"&amp;lt;url1&amp;gt;",&lt;BR /&gt;   &lt;STRONG&gt;"token":"&amp;lt;tokenString1&amp;gt;",&lt;/STRONG&gt;&lt;BR /&gt;   "title":"&amp;lt;title1&amp;gt;",&lt;BR /&gt;   "opacity":&amp;lt;opacity1&amp;gt;,&lt;BR /&gt;   "visibility":"&amp;lt;true | false&amp;gt;",&lt;BR /&gt;   "minScale":&amp;lt;minScale1&amp;gt;,&lt;BR /&gt;   "maxScale":&amp;lt;maxScale1&amp;gt;&lt;BR /&gt; }&lt;BR /&gt;]&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I am wondering if there exists some similar behaviour within the Definition of a&amp;nbsp;&lt;SPAN&gt;CIMFeatureLayer more specifically in its&amp;nbsp;CIMFeatureTable and the underlying&amp;nbsp;CIMStandardDataConnection. Unfortunately there is no documentation on whats supported within the WorkspaceConnectionString property.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;There is a property called "TOKENPROVIDERTYPE" so there is some hidden way to inject a token for authentication?&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;URL=&lt;A title="" target="_blank"&gt;&amp;lt;arcgis-server-url&amp;gt;/services/&amp;lt;feature-service&amp;gt;/FeatureServer;USER=;ENCRYPTED_PASSWORD=XXXXXX;TOKENPROVIDERTYPE=;VERSION=sde.DEFAULT;VERSIONGUID={&amp;lt;guid&amp;gt;&lt;/A&gt;}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp; Any help or hint to a documentation would be appreciated!&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 09:09:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/featureservice-workspaceconnectionstring-with/m-p/1330029#M10415</guid>
      <dc:creator>marco_vertigis</dc:creator>
      <dc:date>2023-09-19T09:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureService WorkspaceConnectionString with Portal Token</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/featureservice-workspaceconnectionstring-with/m-p/1330339#M10422</link>
      <description>&lt;P&gt;hi marco, can u try something like this:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var lyr_params = new LayerCreationParams(....) {
  ServiceCustomParameters = new Dictionary&amp;lt;string, string&amp;gt;(){
    {"TOKENPROVIDERTYPE","1234567890abcdefgh...etc...."}
  }
};&lt;/LI-CODE&gt;&lt;P&gt;the dictionary can be any set of (string, string) key/value pairs fyi&lt;/P&gt;</description>
      <pubDate>Tue, 19 Sep 2023 18:58:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/featureservice-workspaceconnectionstring-with/m-p/1330339#M10422</guid>
      <dc:creator>CharlesMacleod</dc:creator>
      <dc:date>2023-09-19T18:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureService WorkspaceConnectionString with Portal Token</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/featureservice-workspaceconnectionstring-with/m-p/1330955#M10435</link>
      <description>&lt;P&gt;Hi Charles, thanks for your response!&lt;/P&gt;&lt;P&gt;I made some experiments with your hint and could not achieve what I want.&lt;/P&gt;&lt;P&gt;I did the following, first I tried to set the token as suggested by you with the "ServiceCustomparameters" Property:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var lyrx = new LayerDocument(@"C:\layer.lyrx");
var cimLyrDoc = lyrx.GetCIMLayerDocument();
var token = "&amp;lt;token&amp;gt;";
var lcp = new LayerCreationParams(cimLyrDoc);
lcp.ServiceCustomParameters = new Dictionary&amp;lt;string, string&amp;gt;()
{
	{ "TOKENPROVIDERTYPE", token },
	{ "TOKEN", token }
};
var lyr = LayerFactory.Instance.CreateLayer&amp;lt;FeatureLayer&amp;gt;(lcp, map);
var cimLyr = lyr.GetDefinition() as CIMFeatureLayer;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Unfortunately Pro always prompts the Credentials Window as soon as "CreateLayer" is called. Afterwards the ServiceCustomProperties does not seems to be appended to the CustomParameter Field of the CIMStandardDataConnection Object.&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic14849.html" target="_self"&gt;https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic14849.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I did not find any hint within the layer or its CIM structure that the token got appended somewhere. Is this a BUG?&lt;/P&gt;&lt;P&gt;Secondly I made some testing with arcpy.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;&amp;gt; aprx = arcpy.mp.ArcGISProject("CURRENT")
&amp;gt; aprx.activeMap.listLayers()
&amp;gt; lyr = aprx.activeMap.listLayers("broken-layer")
&amp;gt; lyr.getDefinition("V3")
&amp;gt; cim_layer.featureTable.dataConnection.customParameters
# Custom Parameters are empty on the broken layer
[]
&amp;gt; lyr.isBroken
True
# try to set the custom parameters by hand
&amp;gt; cim_map = arcpy.cim.CIMStringMap()
&amp;gt; cim_map.key = "TOKEN"
&amp;gt; cim_map.value = "&amp;lt;token-value&amp;gt;"
&amp;gt; cim_layer.featureTable.dataConnection.customParameters.append(cim_map)
&amp;gt; cim_map2 = arcpy.cim.CIMStringMap()
&amp;gt; cim_map2.key = "TOKENPROVIDERTYPE"
&amp;gt; cim_map2.value = "&amp;lt;token-value&amp;gt;"
&amp;gt; cim_layer.featureTable.dataConnection.customParameters.append(cim_map2)
&amp;gt; cim_layer.featureTable.dataConnection.customParameters
[&amp;lt;arcpy.cim.CIMSymbolizers.CIMStringMap object at 0x0000026CAD106310&amp;gt;, &amp;lt;arcpy.cim.CIMSymbolizers.CIMStringMap object at 0x0000026CAD1065E0&amp;gt;]
# As soon as the definition is set, Pro again prompt the credentials dialog
&amp;gt; lyr.setDefinition(cim_layer)
# still broken even with the token as custom parameter set
&amp;gt; lyr.isBroken
True
&amp;gt; cim_layer = lyr.getDefinition("V3")
&amp;gt; cim_layer.featureTable.dataConnection.customParameters
[&amp;lt;arcpy.cim.CIMSymbolizers.CIMStringMap object at 0x0000026CAC0A08E0&amp;gt;, &amp;lt;arcpy.cim.CIMSymbolizers.CIMStringMap object at 0x0000026CAC0A0880&amp;gt;]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Either I am misunderstanding the customParameters property on the CIMStandardDataConnection wrongly or it does simply not work.&lt;/P&gt;&lt;P&gt;Any further ideas on how I can authenticate my layer with a generated portal token?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT: I even manually exported the broken layer into a .lyrx file and appended the token key value pair to every customProperty/customParameter Field I could find. No effect at all. Lyrx file is attached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2023 09:24:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/featureservice-workspaceconnectionstring-with/m-p/1330955#M10435</guid>
      <dc:creator>marco_vertigis</dc:creator>
      <dc:date>2023-09-21T09:24:20Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureService WorkspaceConnectionString with Portal Token</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/featureservice-workspaceconnectionstring-with/m-p/1343768#M10621</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/145101"&gt;@CharlesMacleod&lt;/a&gt;&amp;nbsp;Any response to this? I have the feeling this feature does not work at all.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2023 12:43:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/featureservice-workspaceconnectionstring-with/m-p/1343768#M10621</guid>
      <dc:creator>marco_vertigis</dc:creator>
      <dc:date>2023-10-31T12:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureService WorkspaceConnectionString with Portal Token</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/featureservice-workspaceconnectionstring-with/m-p/1343959#M10624</link>
      <description>&lt;P&gt;hi marco, sorry, missed your follow on q. i spoke w/ the development team and it "should" work. they cant repro. they're going to put a sample add-in together for u.&lt;/P&gt;&lt;P&gt;note: is it that the token is not being sent or that the server is rejecting the token?&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2023 16:26:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/featureservice-workspaceconnectionstring-with/m-p/1343959#M10624</guid>
      <dc:creator>CharlesMacleod</dc:creator>
      <dc:date>2023-10-31T16:26:19Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureService WorkspaceConnectionString with Portal Token</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/featureservice-workspaceconnectionstring-with/m-p/1344744#M10639</link>
      <description>&lt;P&gt;hi marco, so it's a bug. custom parameter properties in a layer file shld work. the dev team has submitted an issue. if u want to, u can open a bug report with Tech Support and they can link the internal issue to the bug report allowing u to track progress.&lt;/P&gt;&lt;P&gt;The only thing working, it seems, per the dev team, as currently is if custom parameters are added directly to the URL - for example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
        "type" : "CIMFeatureTable",
        "displayField" : "STATE_NAME",
        "editable" : true,
        "dataConnection" : {
          "type" : "CIMStandardDataConnection",

          "customParameters" : [  &amp;lt;----- this is ignored! bug
            {
              "type" : "CIMStringMap",
              "key" : "token",
              "value" : "QVoIg1fwLpgBMAiov2v6P1CYanOHEn27wFNfQI4IoJfB8SG3qfUmnhJZeSS05yyj"
            }
          ],
                                           This shld work (note the url)
          "workspaceConnectionString" : "URL=https://acme.server.com/arcgis/rest/services/Acme_Layers/MapServer;CUSTOMPARAMETERS=token=QVoIg1fwLpgBMAiov2v6P1CYanOHEn27wFNfQI4IoJfB8SG3qfUmnhJZeSS05yyj",   

          "workspaceFactory" : "FeatureService",
          "dataset" : "5",
          "datasetType" : "esriDTFeatureClass"
        },
        "studyAreaSpatialRel" : "esriSpatialRelUndefined",
        "searchOrder" : "esriSearchOrderSpatial"
      }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2023 22:10:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/featureservice-workspaceconnectionstring-with/m-p/1344744#M10639</guid>
      <dc:creator>CharlesMacleod</dc:creator>
      <dc:date>2023-11-01T22:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: FeatureService WorkspaceConnectionString with Portal Token</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/featureservice-workspaceconnectionstring-with/m-p/1346573#M10659</link>
      <description>&lt;P&gt;Hi Charles, thanks for your response! I was able to manipulate the 'workspaceConnectionString' and pass a Portal token. Really appreciate it!&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2023 09:17:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/featureservice-workspaceconnectionstring-with/m-p/1346573#M10659</guid>
      <dc:creator>marco_vertigis</dc:creator>
      <dc:date>2023-11-07T09:17:36Z</dc:date>
    </item>
  </channel>
</rss>

