<?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: OAuth 2.0 authentication for Python API in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/oauth-2-0-authentication-for-python-api/m-p/1684287#M11852</link>
    <description>&lt;P&gt;Over here you are to use your organization's portal URL not&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://pythonapi.playground.esri.com/portal" target="_blank" rel="noopener"&gt;https://pythonapi.playground.esri.com/portal&lt;/A&gt;&amp;nbsp;such as &lt;A href="https://xyz.hhh.com/portal" target="_blank" rel="noopener"&gt;https://xyz.hhh.com/portal. The sample provided by ESRI uses some fake or internal portal of ESRI's as I could tell see below&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DurmusCesar_0-1770988160588.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/148418i947BACC038348C08/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DurmusCesar_0-1770988160588.png" alt="DurmusCesar_0-1770988160588.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 13 Feb 2026 13:09:33 GMT</pubDate>
    <dc:creator>DurmusCesar</dc:creator>
    <dc:date>2026-02-13T13:09:33Z</dc:date>
    <item>
      <title>OAuth 2.0 authentication for Python API</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/oauth-2-0-authentication-for-python-api/m-p/790046#M1568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm having some trouble getting a Python script authenticated via the OAuth 2.0 method described here:&lt;BR /&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/python/guide/working-with-different-authentication-schemes/" title="https://developers.arcgis.com/python/guide/working-with-different-authentication-schemes/"&gt;Working with different authentication schemes | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Following those instructions, I've created a Python App in my organization.&amp;nbsp; My script then does:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;from arcgis.gis import GIS&lt;BR /&gt;gis = GIS("https://pythonapi.playground.esri.com/portal", client_id='************')&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;(Obscuring the client_id so as not to expose my organization to the whole world!)&lt;BR /&gt;Output (in Jupyter Notebook) is this: (note I've replaced the client_id in the url below with '**********'&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;DIV class="" style="color: #000000; background-color: #ffffff;"&gt;&lt;DIV class="" style="color: #000000; padding: 0.4em;"&gt;&lt;PRE style="color: black; background-color: transparent; border: 0px; font-size: inherit; padding: 1px 0px;"&gt;Please sign in to your GIS and paste the code that is obtained below. If a web browser does not automatically open, please navigate to the URL below yourself instead. Opening web browser to navigate to: &lt;A href="https://pythonapi.playground.esri.com/portal/sharing/rest//oauth2/authorize?response_type=code&amp;amp;client_id=59ZcNidqtlSoN4JM&amp;amp;redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&amp;amp;state=TiM8EYsGY0fZgXAndvPSphHA2LbsDD" style="color: #296eaa; background-color: transparent; text-decoration: none;" target="_blank"&gt;https://pythonapi.playground.esri.com/portal/sharing/rest//oauth2/authorize?response_type=code&amp;amp;client_id=************&amp;amp;redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&amp;amp;state=TiM8EYsGY0fZgXAndvPSphHA2LbsDD&lt;/A&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="" style="color: #000000; background-color: #ffffff;"&gt;&lt;DIV class="" style="padding: 0px 0.4em;"&gt;&lt;/DIV&gt;&lt;DIV class="" style="padding: 5px 0.4em 0.4em;"&gt;&lt;PRE class="" style="color: black; background-color: transparent; border: 0px; font-size: inherit; padding: 1px 0px;"&gt;Enter code obtained on signing in using SAML: &lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I click on the link and get this in my browser:&lt;IMG alt="" class="jive-emoji image-1 jive-image" height="307" src="/legacyfs/online/509156_Screenshot 2020-10-02 at 17.15.13.png" width="547" /&gt;&lt;/P&gt;&lt;P&gt;What's going wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(By the way, I recognize that it may be impossible to troubleshoot without sharing the client_id.&amp;nbsp; If that's the case...oh well!)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One possibility: I'm running jupyter notebook on a (headless) server in my office at work.&amp;nbsp; But I'm accessing the server from my chromebook at home.&amp;nbsp; So when the script executes, the request being sent to pythonapi.playground.esri.com is coming from my office server.&amp;nbsp; But then I'm clicking on the link from my chromebook at home, so THAT request arriving at pythonapi.playground.esri.com from a different IP and a different machine.&amp;nbsp; Perhaps this causing some kind of mis-match in the request headers (the one from the script vs the one from the browser) that causes the "Invalid client_id" error?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Oct 2020 21:31:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/oauth-2-0-authentication-for-python-api/m-p/790046#M1568</guid>
      <dc:creator>StuartJordan</dc:creator>
      <dc:date>2020-10-02T21:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: OAuth 2.0 authentication for Python API</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/oauth-2-0-authentication-for-python-api/m-p/1057037#M6047</link>
      <description>&lt;P&gt;Similar Q here.&amp;nbsp; Did you find a solution?&lt;BR /&gt;Want to deploy some python scripts using ArcGIS API for Python onto Lambda, and leverage client_id&lt;/P&gt;</description>
      <pubDate>Wed, 12 May 2021 11:17:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/oauth-2-0-authentication-for-python-api/m-p/1057037#M6047</guid>
      <dc:creator>jakc13</dc:creator>
      <dc:date>2021-05-12T11:17:10Z</dc:date>
    </item>
    <item>
      <title>Re: OAuth 2.0 authentication for Python API</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/oauth-2-0-authentication-for-python-api/m-p/1345283#M9228</link>
      <description>&lt;P&gt;I also have a similar question.&lt;/P&gt;&lt;P&gt;The exact same thing happens to me that happens to&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/64651"&gt;@StuartJordan&lt;/a&gt;&amp;nbsp;, and I noticed that the URL my Python script directs me to begins with "&lt;A href="https://my-organization.maps.arcgis.com/sharing/rest/oauth2/authorize" target="_blank"&gt;https://my-organization.maps.arcgis.com/sharing/rest/oauth2/authorize&lt;/A&gt;?...", whereas the one that I'm usually directed to upon logging into ArcGIS online begins "&lt;A href="https://my-organization.maps.arcgis.com/sharing/oauth2/authorize?...&amp;quot;" target="_blank"&gt;https://my-organization.maps.arcgis.com/sharing/oauth2/authorize?..."&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Are there any updates to this topic, or can anyone help?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2023 21:00:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/oauth-2-0-authentication-for-python-api/m-p/1345283#M9228</guid>
      <dc:creator>ErinKiley</dc:creator>
      <dc:date>2023-11-02T21:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: OAuth 2.0 authentication for Python API</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/oauth-2-0-authentication-for-python-api/m-p/1684287#M11852</link>
      <description>&lt;P&gt;Over here you are to use your organization's portal URL not&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://pythonapi.playground.esri.com/portal" target="_blank" rel="noopener"&gt;https://pythonapi.playground.esri.com/portal&lt;/A&gt;&amp;nbsp;such as &lt;A href="https://xyz.hhh.com/portal" target="_blank" rel="noopener"&gt;https://xyz.hhh.com/portal. The sample provided by ESRI uses some fake or internal portal of ESRI's as I could tell see below&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DurmusCesar_0-1770988160588.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/148418i947BACC038348C08/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DurmusCesar_0-1770988160588.png" alt="DurmusCesar_0-1770988160588.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Feb 2026 13:09:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/oauth-2-0-authentication-for-python-api/m-p/1684287#M11852</guid>
      <dc:creator>DurmusCesar</dc:creator>
      <dc:date>2026-02-13T13:09:33Z</dc:date>
    </item>
  </channel>
</rss>

