<?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: Exception: Unable to generate oauth token in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/exception-unable-to-generate-oauth-token/m-p/1338184#M9150</link>
    <description>&lt;P&gt;Are you saying this is in fact not a built in user? Are you actually using Azure AD? DO you happen to know how the portal was sconfigured?&lt;/P&gt;</description>
    <pubDate>Mon, 16 Oct 2023 13:09:53 GMT</pubDate>
    <dc:creator>EarlMedina</dc:creator>
    <dc:date>2023-10-16T13:09:53Z</dc:date>
    <item>
      <title>Exception: Unable to generate oauth token</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/exception-unable-to-generate-oauth-token/m-p/1337991#M9144</link>
      <description>&lt;P&gt;I am trying to&amp;nbsp;Connect to ArcGIS Enterprise v11.1 using a built-in account as described in tutorial --&amp;gt;&amp;nbsp;&lt;A href="https://developers.arcgis.com/python/guide/working-with-different-authentication-schemes/#User-authentication-with-OAuth-2.0" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/python/guide/working-with-different-authentication-schemes/#User-authentication-with-OAuth-2.0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Here is my entire code:&lt;/P&gt;&lt;P&gt;---------------------------------------------------------&lt;/P&gt;&lt;H2&gt;from arcgis.gis import GIS&lt;/H2&gt;&lt;H2&gt;portal_url = '&lt;A href="https://myserver.org/portal/portaladmin/" target="_blank" rel="noopener"&gt;https://myserver.org/portal/portaladmin/&lt;/A&gt;'&lt;/H2&gt;&lt;H2&gt;username = 'portaladmin'&lt;/H2&gt;&lt;H2&gt;password = 'pasw1234'&lt;/H2&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;print&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"Portal for ArcGIS as a built in user"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;gis&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt; GIS(&lt;/SPAN&gt;&lt;SPAN&gt;portal_url&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;username&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;password&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;print&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"Logged in as: "&lt;/SPAN&gt; &lt;SPAN&gt;+&lt;/SPAN&gt; &lt;SPAN&gt;gis&lt;/SPAN&gt;&lt;SPAN&gt;.properties.user.username)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;i get this error:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Exception: Unable to generate oauth token&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;How to solve this? Do i have to register this simple script as an App in Azure AD or something?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Oct 2023 08:30:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/exception-unable-to-generate-oauth-token/m-p/1337991#M9144</guid>
      <dc:creator>TZ</dc:creator>
      <dc:date>2023-10-14T08:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: Exception: Unable to generate oauth token</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/exception-unable-to-generate-oauth-token/m-p/1338012#M9146</link>
      <description>&lt;P&gt;Remove "portaladmin". It should be: "&lt;A href="https://myserver.org/portal" target="_blank"&gt;https://myserver.org/portal&lt;/A&gt;" from your example.&lt;/P&gt;</description>
      <pubDate>Sat, 14 Oct 2023 18:45:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/exception-unable-to-generate-oauth-token/m-p/1338012#M9146</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2023-10-14T18:45:38Z</dc:date>
    </item>
    <item>
      <title>Re: Exception: Unable to generate oauth token</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/exception-unable-to-generate-oauth-token/m-p/1338098#M9147</link>
      <description>&lt;P&gt;I changed the "portal_url" value to&amp;nbsp;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;A href="https://myserver.org/portal" target="_blank" rel="nofollow noopener noreferrer"&gt;https://myserver.org/portal&lt;/A&gt;&lt;SPAN&gt;" as per your suggestion but still get the same error "Unable to generate oauth token", the only difference being an informational message "Portal for ArcGIS as a built in user" in the output at the very beginning.&lt;BR /&gt;&lt;BR /&gt;Are there any more guides regarding setting up OAuth for ArcGIS Python API aside this very scant page ? --&amp;gt;&amp;nbsp;&lt;A href="https://developers.arcgis.com/python/guide/working-with-different-authentication-schemes/#User-authentication-with-OAuth-2.0" target="_blank"&gt;https://developers.arcgis.com/python/guide/working-with-different-authentication-schemes/#User-authentication-with-OAuth-2.0&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2023 05:55:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/exception-unable-to-generate-oauth-token/m-p/1338098#M9147</guid>
      <dc:creator>TZ</dc:creator>
      <dc:date>2023-10-16T05:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: Exception: Unable to generate oauth token</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/exception-unable-to-generate-oauth-token/m-p/1338099#M9148</link>
      <description>&lt;P&gt;and what about my previous question - do i have to register this modest script as an app in Azure AD or not??&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2023 05:57:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/exception-unable-to-generate-oauth-token/m-p/1338099#M9148</guid>
      <dc:creator>TZ</dc:creator>
      <dc:date>2023-10-16T05:57:28Z</dc:date>
    </item>
    <item>
      <title>Re: Exception: Unable to generate oauth token</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/exception-unable-to-generate-oauth-token/m-p/1338184#M9150</link>
      <description>&lt;P&gt;Are you saying this is in fact not a built in user? Are you actually using Azure AD? DO you happen to know how the portal was sconfigured?&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2023 13:09:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/exception-unable-to-generate-oauth-token/m-p/1338184#M9150</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2023-10-16T13:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: Exception: Unable to generate oauth token</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/exception-unable-to-generate-oauth-token/m-p/1339832#M9172</link>
      <description>&lt;P&gt;I started seeing this same issue that started yesterday. Do you have a solution or work-around? I've been using this calls in scripts for more than a year, no problem until now.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ellipsol_0-1697751666618.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/83547iEA44435DEDEA7AD2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ellipsol_0-1697751666618.png" alt="ellipsol_0-1697751666618.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2023 21:41:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/exception-unable-to-generate-oauth-token/m-p/1339832#M9172</guid>
      <dc:creator>ellipsol</dc:creator>
      <dc:date>2023-10-19T21:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: Exception: Unable to generate oauth token</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/exception-unable-to-generate-oauth-token/m-p/1343950#M9211</link>
      <description>&lt;P&gt;My proxy changed and that was what was causing this error. It is resolved now.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2023 16:07:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/exception-unable-to-generate-oauth-token/m-p/1343950#M9211</guid>
      <dc:creator>ellipsol</dc:creator>
      <dc:date>2023-10-31T16:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: Exception: Unable to generate oauth token</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/exception-unable-to-generate-oauth-token/m-p/1578712#M11087</link>
      <description>&lt;P&gt;where are you specifying the proxy changes? I have a very similar issue, but I know nothing has changed....&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2025 16:04:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/exception-unable-to-generate-oauth-token/m-p/1578712#M11087</guid>
      <dc:creator>Danfranco</dc:creator>
      <dc:date>2025-01-24T16:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: Exception: Unable to generate oauth token</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/exception-unable-to-generate-oauth-token/m-p/1606881#M11326</link>
      <description>&lt;P&gt;The only things I have seen work (dependent on your Pro version) are use_gen_token=True, which ignores oAuth and uses the built-in users you have.&lt;BR /&gt;&lt;BR /&gt;However, this is the issue I am experiencing now, where it causes issues if its not added i.e. it won't login without use_gen_token, but then when trying to query a layer I get an invalid token.&lt;BR /&gt;&lt;BR /&gt;The documentation is rather poor, and every pro upgrade, is a finger in the air as to whether your existing code will work &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Apr 2025 14:12:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/exception-unable-to-generate-oauth-token/m-p/1606881#M11326</guid>
      <dc:creator>Danfranco</dc:creator>
      <dc:date>2025-04-17T14:12:33Z</dc:date>
    </item>
    <item>
      <title>Re: Exception: Unable to generate oauth token</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/exception-unable-to-generate-oauth-token/m-p/1612252#M11355</link>
      <description>&lt;P&gt;I had a proxy in my browser settings. My employer stopped using that proxy though and it caused these errors. It was fine once I turned off the "Manual proxy setup" in Chrome. These days I use a profile to log in. You can set up in a notebook from Pro.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;### Set up a profile
from arcgis.gis import GIS
gis_profile = GIS("https://subdomain.maps.arcgis.com", "un", "pw", profile="gisprof")
print("Profile defined for {}".format(gis_profile))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And then in my scripts I call:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;mygis = GIS("https://subdomain.maps.arcgis.com", profile="gisprof")
print("Connected to the GIS as {}.".format(mygis.properties.user.username))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does that work for you?&lt;/P&gt;</description>
      <pubDate>Tue, 06 May 2025 23:01:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/exception-unable-to-generate-oauth-token/m-p/1612252#M11355</guid>
      <dc:creator>ellipsol</dc:creator>
      <dc:date>2025-05-06T23:01:17Z</dc:date>
    </item>
  </channel>
</rss>

