<?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: Access token to access private ArcGIS enterprise contents in ArcGIS Maps SDK for Unity Questions</title>
    <link>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/access-token-to-access-private-arcgis-enterprise/m-p/1393979#M793</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to access layers from a private ArcGIS GDI, too. I am trying it programmatically, using and adjusting the examples from:&lt;/P&gt;&lt;P&gt;/Assets/Samples/ArcGIS Maps SDK for Unity/1.4.0/Sample Content/Scenes/Scripts/Security&lt;/P&gt;&lt;P&gt;Using &lt;A href="http://127.0.0.1:7070" target="_blank"&gt;http://127.0.0.1:7070&lt;/A&gt;&amp;nbsp;as redirectUrl, it works until we are getting the authorization code from authorize endpoint within the running web server inside unity application. But in line 45 of SampleOAuthAuthenticationChallengeHandler.cs, the code ist passed to a Respond method, which expects a token.&lt;/P&gt;&lt;P&gt;So, to me, it looks like a POST request to token endpoint, exchanging the authorization code into an actual token is missing?!&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;if (authorizationCode != null){						 
    oauthAuthenticationChallenge.Respond(authorizationCode);
}&lt;/LI-CODE&gt;&lt;P&gt;I can implement that request on my own, for sure, but how is the exemple extended? Or am I missing something?&lt;/P&gt;&lt;P&gt;Thanks for any help, regards, Nils&lt;/P&gt;</description>
    <pubDate>Mon, 11 Mar 2024 10:00:48 GMT</pubDate>
    <dc:creator>nilskuhn</dc:creator>
    <dc:date>2024-03-11T10:00:48Z</dc:date>
    <item>
      <title>Access token to access private ArcGIS enterprise contents</title>
      <link>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/access-token-to-access-private-arcgis-enterprise/m-p/1323374#M591</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;We are trying to access some private layers stored in our ArcGIS enterprise hosting. The examples provided don’t seem to work, so we implemented our own method to generate and retrieve the token using OAuth 2.0. However even with the token I cannot access the private layers.&lt;/P&gt;&lt;P&gt;I tried to set the token parameter in this way (see &lt;A href="https://developers.arcgis.com/documentation/mapping-apis-and-services/security/):" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/documentation/mapping-apis-and-services/security/):&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var layer_1 = new Esri.GameEngine.Layers.ArcGISImageLayer("https://&amp;lt;LOCATION_SERVICE_URL&amp;gt;?token=&amp;lt;ACCESS_TOKEN&amp;gt;", “UN_Map_Imagery", 1.0f, true, "");
arcGISMap.Layers.Add(layer_1);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or putting the token as API key like that:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var layer_1 = new Esri.GameEngine.Layers.ArcGISImageLayer("&amp;lt;my rest service&amp;gt;", “UN_Map_Imagery", 1.0f, true, "&amp;lt;access_token&amp;gt;");
arcGISMap.Layers.Add(layer_1);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But none of these methods work. From the log, when I am trying to access the layer I am always getting:&amp;nbsp;&amp;nbsp;&lt;EM&gt;Error (Propagated error.)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;Ferdinando&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2023 14:15:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/access-token-to-access-private-arcgis-enterprise/m-p/1323374#M591</guid>
      <dc:creator>Fer</dc:creator>
      <dc:date>2023-08-30T14:15:31Z</dc:date>
    </item>
    <item>
      <title>Re: Access token to access private ArcGIS enterprise contents</title>
      <link>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/access-token-to-access-private-arcgis-enterprise/m-p/1324958#M596</link>
      <description>&lt;P&gt;Hi Ferdinando, thank you for reaching out.&lt;BR /&gt;Appending the token to the service URL is not a valid workflow. Using the token you have, you can construct a credential in code. I recommend trying the following.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var credential = new ArcGISOAuthAuthorizationCredential("&amp;lt;ACCESSTOKEN&amp;gt;", DateTimeOffset.MaxValue, "&amp;lt;REFRESHTOKEN&amp;gt;");

var authenticationConfiguration = new ArcGISOAuthAuthenticationConfiguration("&amp;lt;CLIENTID&amp;gt;".Trim(), "&amp;lt;CLIENTSECRET&amp;gt;", "&amp;lt;REDIRECTURI&amp;gt;".Trim(), credential);
	
ArcGISAuthenticationManager.AuthenticationConfigurations.Add("&amp;lt;SERVICEURL&amp;gt;", authenticationConfiguration);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;Also, I am curious why the provided OAuth sample did not work with your data.&amp;nbsp;&lt;EM&gt;ArcGISOAuthAuthenticationConfiguration&lt;/EM&gt; has a&amp;nbsp;&lt;EM&gt;AuthorizationCredentialIssuedEvent&lt;/EM&gt;. It might be worth checking if this event fires when attempting to authenticate using the pattern in the OAuth sample.&lt;BR /&gt;&lt;BR /&gt;I hope this helps, please let me know if you have further questions.&lt;BR /&gt;&lt;BR /&gt;Zack&lt;/P&gt;</description>
      <pubDate>Fri, 01 Sep 2023 21:13:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/access-token-to-access-private-arcgis-enterprise/m-p/1324958#M596</guid>
      <dc:creator>ZackAllen</dc:creator>
      <dc:date>2023-09-01T21:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: Access token to access private ArcGIS enterprise contents</title>
      <link>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/access-token-to-access-private-arcgis-enterprise/m-p/1325374#M599</link>
      <description>&lt;P&gt;Hi Zack,&lt;/P&gt;&lt;P&gt;Many thanks for your reply. This is exactly what we were looking for.&lt;/P&gt;&lt;P&gt;We also managed to make OAuth sample work, even though there are some unexpected behaviour. The problem for us was in the redirect uri setting.&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;Ferdinando&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 13:27:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/access-token-to-access-private-arcgis-enterprise/m-p/1325374#M599</guid>
      <dc:creator>Fer</dc:creator>
      <dc:date>2023-09-05T13:27:11Z</dc:date>
    </item>
    <item>
      <title>Re: Access token to access private ArcGIS enterprise contents</title>
      <link>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/access-token-to-access-private-arcgis-enterprise/m-p/1393979#M793</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to access layers from a private ArcGIS GDI, too. I am trying it programmatically, using and adjusting the examples from:&lt;/P&gt;&lt;P&gt;/Assets/Samples/ArcGIS Maps SDK for Unity/1.4.0/Sample Content/Scenes/Scripts/Security&lt;/P&gt;&lt;P&gt;Using &lt;A href="http://127.0.0.1:7070" target="_blank"&gt;http://127.0.0.1:7070&lt;/A&gt;&amp;nbsp;as redirectUrl, it works until we are getting the authorization code from authorize endpoint within the running web server inside unity application. But in line 45 of SampleOAuthAuthenticationChallengeHandler.cs, the code ist passed to a Respond method, which expects a token.&lt;/P&gt;&lt;P&gt;So, to me, it looks like a POST request to token endpoint, exchanging the authorization code into an actual token is missing?!&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;if (authorizationCode != null){						 
    oauthAuthenticationChallenge.Respond(authorizationCode);
}&lt;/LI-CODE&gt;&lt;P&gt;I can implement that request on my own, for sure, but how is the exemple extended? Or am I missing something?&lt;/P&gt;&lt;P&gt;Thanks for any help, regards, Nils&lt;/P&gt;</description>
      <pubDate>Mon, 11 Mar 2024 10:00:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-maps-sdk-for-unity-questions/access-token-to-access-private-arcgis-enterprise/m-p/1393979#M793</guid>
      <dc:creator>nilskuhn</dc:creator>
      <dc:date>2024-03-11T10:00:48Z</dc:date>
    </item>
  </channel>
</rss>

