<?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 do i paste OAuth2 Approval code into python toolbox in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-paste-oauth2-approval-code-into-python/m-p/1607271#M11329</link>
    <description>&lt;P&gt;I created a python toolbox with the following code:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
gis = GIS("my portal url", client_id='my client id') &lt;/LI-CODE&gt;&lt;P&gt;When I run the toolbox, a browser pops up with a OAuth2 Approval code which is expected. (see screenshot).&lt;/P&gt;&lt;P&gt;The question is how can I paste that code back into my running toolbox?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="todddoerr2_0-1744983237431.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/130536iCA40F705365089C0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="todddoerr2_0-1744983237431.png" alt="todddoerr2_0-1744983237431.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 18 Apr 2025 13:50:41 GMT</pubDate>
    <dc:creator>todddoerr2</dc:creator>
    <dc:date>2025-04-18T13:50:41Z</dc:date>
    <item>
      <title>how do i paste OAuth2 Approval code into python toolbox</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-paste-oauth2-approval-code-into-python/m-p/1607271#M11329</link>
      <description>&lt;P&gt;I created a python toolbox with the following code:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
gis = GIS("my portal url", client_id='my client id') &lt;/LI-CODE&gt;&lt;P&gt;When I run the toolbox, a browser pops up with a OAuth2 Approval code which is expected. (see screenshot).&lt;/P&gt;&lt;P&gt;The question is how can I paste that code back into my running toolbox?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="todddoerr2_0-1744983237431.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/130536iCA40F705365089C0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="todddoerr2_0-1744983237431.png" alt="todddoerr2_0-1744983237431.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Apr 2025 13:50:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-paste-oauth2-approval-code-into-python/m-p/1607271#M11329</guid>
      <dc:creator>todddoerr2</dc:creator>
      <dc:date>2025-04-18T13:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: how do i paste OAuth2 Approval code into python toolbox</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-paste-oauth2-approval-code-into-python/m-p/1621256#M11433</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;I am wondering, because you are working with a Python toolbox geoprocessing tool then the tool doesn't allow you to paste that approval code back into the tool.....&lt;/P&gt;&lt;P&gt;so...&lt;/P&gt;&lt;P&gt;Do you use the same account to log into ArcGIS Pro? If so could you use the "pro" option to pass into the GIS class as authentication has already been achieved?&lt;/P&gt;&lt;P&gt;So:&lt;/P&gt;&lt;P&gt;gis = GIS('pro')&lt;/P&gt;&lt;P&gt;And so everytime you use SSO to access ArcGIS Pro then your tool will automatically use those SSO credentials.&lt;/P&gt;&lt;P&gt;Would that be useful?&lt;/P&gt;&lt;P&gt;Many thanks ed&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jun 2025 17:33:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-paste-oauth2-approval-code-into-python/m-p/1621256#M11433</guid>
      <dc:creator>EdMorris</dc:creator>
      <dc:date>2025-06-05T17:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: how do i paste OAuth2 Approval code into python toolbox</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-paste-oauth2-approval-code-into-python/m-p/1621341#M11434</link>
      <description>&lt;P&gt;You're suggestion solves part of the problem.&amp;nbsp; But if the user isn't logged into our portal than that suggestion doesn't work.&amp;nbsp; I ultimately used the client_secret parameter in my GIS call.&lt;/P&gt;&lt;P&gt;So my code looks like this now.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;gis = GIS(portal, client_id=clientId, client_secret=clientSecret)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 05 Jun 2025 20:13:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-paste-oauth2-approval-code-into-python/m-p/1621341#M11434</guid>
      <dc:creator>todddoerr2</dc:creator>
      <dc:date>2025-06-05T20:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: how do i paste OAuth2 Approval code into python toolbox</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-paste-oauth2-approval-code-into-python/m-p/1630392#M11493</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Many apologies for not replying sooner. I'm glad that you found a solution which works for you - great job!&lt;/P&gt;&lt;P&gt;ed&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jul 2025 10:48:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-do-i-paste-oauth2-approval-code-into-python/m-p/1630392#M11493</guid>
      <dc:creator>EdMorris</dc:creator>
      <dc:date>2025-07-04T10:48:56Z</dc:date>
    </item>
  </channel>
</rss>

