<?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 How to share OAuth Access Token server-side &amp; client-side? in .NET and the Esri JavaScript API Questions</title>
    <link>https://community.esri.com/t5/net-and-the-esri-javascript-api-questions/how-to-share-oauth-access-token-server-side-client/m-p/851846#M69</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have an ASP.NET MVC web application that is authenticating users server-side against ArcGIS Portal successfully using &lt;A href="https://github.com/gavinharriss/OwinOAuthProviders/tree/master/src/Owin.Security.Providers.ArcGISPortal"&gt;Owin.Security.Providers.ArcGISPortal&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to use the granted authorization client-side in the browser without requiring the user to login a second time via ArcGIS's JavaScript API v3.21. Does anyone have any pointers regarding how to obtain a relevant token and pass this through client-side to access portal secured web maps, etc.?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a context.AccessToken that I can obtain via &lt;A href="https://github.com/gavinharriss/OwinOAuthProviders/blob/master/src/Owin.Security.Providers.ArcGISPortal/ArcGISPortalAuthenticationHandler.cs"&gt;ArcGISPortalAuthenticationHandler&lt;/A&gt; and make available as a claim, but when I try to use this manually via a url like so&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fmyportal.domain.com%2Farcgis%2Fsharing%2Frest%2Fcontent%2Fitems%2F1c3fbebbd4994f94b7e4d91449c2954c%2Fdata%3Ff%3Djson%26token%3D" rel="nofollow" target="_blank"&gt;https://myportal.domain.com/arcgis/sharing/rest/content/items/1c3fbebbd4994f94b7e4d91449c2954c/data?f=json&amp;amp;token=&lt;/A&gt;&lt;SPAN&gt;{access_token}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I get an "Invalid token" response back.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas? If you know of a working example for ArcGIS Online then this could also help me as ArcGIS Online and ArcGIS Portal seem to be identical in their mechanics.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 28 Sep 2017 21:15:26 GMT</pubDate>
    <dc:creator>GavinHarriss</dc:creator>
    <dc:date>2017-09-28T21:15:26Z</dc:date>
    <item>
      <title>How to share OAuth Access Token server-side &amp; client-side?</title>
      <link>https://community.esri.com/t5/net-and-the-esri-javascript-api-questions/how-to-share-oauth-access-token-server-side-client/m-p/851846#M69</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have an ASP.NET MVC web application that is authenticating users server-side against ArcGIS Portal successfully using &lt;A href="https://github.com/gavinharriss/OwinOAuthProviders/tree/master/src/Owin.Security.Providers.ArcGISPortal"&gt;Owin.Security.Providers.ArcGISPortal&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to use the granted authorization client-side in the browser without requiring the user to login a second time via ArcGIS's JavaScript API v3.21. Does anyone have any pointers regarding how to obtain a relevant token and pass this through client-side to access portal secured web maps, etc.?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a context.AccessToken that I can obtain via &lt;A href="https://github.com/gavinharriss/OwinOAuthProviders/blob/master/src/Owin.Security.Providers.ArcGISPortal/ArcGISPortalAuthenticationHandler.cs"&gt;ArcGISPortalAuthenticationHandler&lt;/A&gt; and make available as a claim, but when I try to use this manually via a url like so&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fmyportal.domain.com%2Farcgis%2Fsharing%2Frest%2Fcontent%2Fitems%2F1c3fbebbd4994f94b7e4d91449c2954c%2Fdata%3Ff%3Djson%26token%3D" rel="nofollow" target="_blank"&gt;https://myportal.domain.com/arcgis/sharing/rest/content/items/1c3fbebbd4994f94b7e4d91449c2954c/data?f=json&amp;amp;token=&lt;/A&gt;&lt;SPAN&gt;{access_token}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I get an "Invalid token" response back.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas? If you know of a working example for ArcGIS Online then this could also help me as ArcGIS Online and ArcGIS Portal seem to be identical in their mechanics.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Sep 2017 21:15:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-and-the-esri-javascript-api-questions/how-to-share-oauth-access-token-server-side-client/m-p/851846#M69</guid>
      <dc:creator>GavinHarriss</dc:creator>
      <dc:date>2017-09-28T21:15:26Z</dc:date>
    </item>
  </channel>
</rss>

