<?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: Python API Authentication by OAuth2.0 &amp;quot;Interactive Login Experience&amp;quot; results in &amp;quot;Invalid redirect_uri&amp;quot; in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/python-api-authentication-by-oauth2-0-quot/m-p/1345682#M9237</link>
    <description>&lt;P&gt;Okay, chiming in again:&lt;/P&gt;&lt;P&gt;The "InsecureRequestWarning" is one that shouldn't really be ignored, but if you want to suppress it, you can include the following lines of code before the gis=GIS(...) call:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Nov 2023 17:57:20 GMT</pubDate>
    <dc:creator>ErinKiley</dc:creator>
    <dc:date>2023-11-03T17:57:20Z</dc:date>
    <item>
      <title>Python API Authentication by OAuth2.0 "Interactive Login Experience" results in "Invalid redirect_uri"</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/python-api-authentication-by-oauth2-0-quot/m-p/1345290#M9229</link>
      <description>&lt;P&gt;I'd like to use the ArcGIS API in a Jupyter notebook, and have followed the instructions here ( &lt;A href="https://developers.arcgis.com/python/guide/working-with-different-authentication-schemes/" target="_blank"&gt;https://developers.arcgis.com/python/guide/working-with-different-authentication-schemes/&lt;/A&gt;&amp;nbsp;) under the section "Interactive Login Experience".&lt;/P&gt;&lt;P data-unlink="true"&gt;When I typically log into ArcGIS online, using my web browser, I see the mixed mode setup for Portal (like described in the solution to the question here: (&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-api-for-python-questions/enterprise-python-authentication/m-p/1022873" target="_blank"&gt;https://community.esri.com/t5/arcgis-api-for-python-questions/enterprise-python-authentication/m-p/1022873&lt;/A&gt;&amp;nbsp;)), and the URL that I am typically redirected to for login begins with "https://my-company.maps.arcgis.com/sharing/oauth2/authorize?..."&amp;nbsp;&amp;nbsp;&amp;nbsp;.&lt;/P&gt;&lt;P data-unlink="true"&gt;However, when I implement the instructions for the "Interactive Login Experience" in my Jupyter notebook, I'm executing the line&lt;/P&gt;&lt;LI-CODE lang="python"&gt;gis=GIS("https://my-company.maps.arcgis.com",client_id="...")&lt;/LI-CODE&gt;&lt;P data-unlink="true"&gt;(where, of course, "my-company" is fake and the ellipsis assigned to "client_id" is actually my Client ID)&lt;/P&gt;&lt;P data-unlink="true"&gt;I'm brought to a URL beginning with "https://my-company.maps.arcgis.com/sharing/&lt;STRONG&gt;rest&lt;/STRONG&gt;/oauth2/authorize?..."&amp;nbsp; (bold emphasis is mine---to show how this URL differs from that of my usual login page). I get an "Error 400 "Invalid redirect_uri".&lt;/P&gt;&lt;P data-unlink="true"&gt;What do I need to do differently?&lt;/P&gt;&lt;P data-unlink="true"&gt;Thank you for any insight...&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2023 21:16:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/python-api-authentication-by-oauth2-0-quot/m-p/1345290#M9229</guid>
      <dc:creator>ErinKiley</dc:creator>
      <dc:date>2023-11-02T21:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: Python API Authentication by OAuth2.0 "Interactive Login Experience" results in "Invalid redirect_uri"</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/python-api-authentication-by-oauth2-0-quot/m-p/1345320#M9230</link>
      <description>&lt;P&gt;I believe the expected URL is in fact in that format. Perhaps you can manually set the redirect uri and see if that does anything?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2023 22:21:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/python-api-authentication-by-oauth2-0-quot/m-p/1345320#M9230</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2023-11-02T22:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: Python API Authentication by OAuth2.0 "Interactive Login Experience" results in "Invalid redirect_uri"</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/python-api-authentication-by-oauth2-0-quot/m-p/1345355#M9231</link>
      <description>&lt;P&gt;Thank you for checking the format---I'm not sure what the redirect uri should be set to? Currently, that portion of the URL is:&amp;nbsp; "redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&amp;amp;state=CFm8xSt6n5f8aS1ZmXYF5F9ieF03ZA&amp;amp;allow_verification=false" . Thank you in advance for any leads you could provide on this!&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2023 00:59:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/python-api-authentication-by-oauth2-0-quot/m-p/1345355#M9231</guid>
      <dc:creator>ErinKiley</dc:creator>
      <dc:date>2023-11-03T00:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: Python API Authentication by OAuth2.0 "Interactive Login Experience" results in "Invalid redirect_uri"</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/python-api-authentication-by-oauth2-0-quot/m-p/1345376#M9232</link>
      <description>&lt;P&gt;Okay... I followed the instructions here (&amp;nbsp;&lt;A href="https://developers.arcgis.com/documentation/mapping-apis-and-services/security/tutorials/add-redirect-uri/" target="_blank"&gt;https://developers.arcgis.com/documentation/mapping-apis-and-services/security/tutorials/add-redirect-uri/&lt;/A&gt;&amp;nbsp;) and added "&lt;A href="https://my-company.maps.arcgis.com" target="_blank"&gt;https://my-company.maps.arcgis.com&lt;/A&gt;" to the Redirect uri list, and for good measure, after seeing page 38 of this explanation of authentication (&amp;nbsp;&lt;A href="https://proceedings.esri.com/library/userconf/devsummit-mea13/papers/dsmea_18.pdf" target="_blank"&gt;https://proceedings.esri.com/library/userconf/devsummit-mea13/papers/dsmea_18.pdf&lt;/A&gt;&amp;nbsp;), I also added my client secret to the call in my Jupyter notebook:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;gis=GIS("https://my-company.maps.arcgis.com",client_id="...",client_secret="...")&lt;/LI-CODE&gt;&lt;P&gt;Something here worked, and I no longer get errors (actually, I don't seem to need to receive and paste a code back to my Jupyter notebook, as I'd expected to have to do).&lt;/P&gt;&lt;P&gt;I'm getting the warning in my Jupyter notebook "InsecureRequestWarning: Unverified HTTPS request is being made to host 'the-uri-i-specified". Adding certificate verification is strongly advised." I'm going to read up on this warning and see if I can clear it, then I'll be totally golden.&lt;/P&gt;&lt;P&gt;Thank you,&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/86309"&gt;@EarlMedina&lt;/a&gt;&amp;nbsp;, for the help!&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2023 01:31:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/python-api-authentication-by-oauth2-0-quot/m-p/1345376#M9232</guid>
      <dc:creator>ErinKiley</dc:creator>
      <dc:date>2023-11-03T01:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: Python API Authentication by OAuth2.0 "Interactive Login Experience" results in "Invalid redirect_uri"</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/python-api-authentication-by-oauth2-0-quot/m-p/1345682#M9237</link>
      <description>&lt;P&gt;Okay, chiming in again:&lt;/P&gt;&lt;P&gt;The "InsecureRequestWarning" is one that shouldn't really be ignored, but if you want to suppress it, you can include the following lines of code before the gis=GIS(...) call:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2023 17:57:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/python-api-authentication-by-oauth2-0-quot/m-p/1345682#M9237</guid>
      <dc:creator>ErinKiley</dc:creator>
      <dc:date>2023-11-03T17:57:20Z</dc:date>
    </item>
    <item>
      <title>Re: Python API Authentication by OAuth2.0 "Interactive Login Experience" results in "Invalid redirect_uri"</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/python-api-authentication-by-oauth2-0-quot/m-p/1416113#M9952</link>
      <description>&lt;P&gt;According to&amp;nbsp;&lt;A href="https://developers.arcgis.com/documentation/mapping-apis-and-services/security/app-credential-authentication/" target="_blank"&gt;https://developers.arcgis.com/documentation/mapping-apis-and-services/security/app-credential-authentication/&lt;/A&gt;&amp;nbsp;the expected way is to first get a token, then use it. Then there are no complaints.&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the code could look like (note that it's a app credential):&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# import the GIS class in gis module
from arcgis.gis import GIS
from arcgis.features import FeatureLayer
import requests  # pip install requests

# Get client credentials using the Developer portal and set the client_xx
# variables below. 
# https://developers.arcgis.com/applications/
def get_token():
    params = {
        'client_id': 'xxx',
        'client_secret': 'xxx',
        'grant_type': "client_credentials"
    }
    request = requests.get('https://www.arcgis.com/sharing/rest/oauth2/token',
                          params=params)
    response = request.json()
    token = response["access_token"]
    return token

token = get_token()

print("ArcGIS Online")
gis = GIS(token = token)
print("Logged in to " + gis.properties.portalName)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 21:03:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/python-api-authentication-by-oauth2-0-quot/m-p/1416113#M9952</guid>
      <dc:creator>stepavac</dc:creator>
      <dc:date>2024-04-26T21:03:15Z</dc:date>
    </item>
    <item>
      <title>Re: Python API Authentication by OAuth2.0 "Interactive Login Experience" results in "Invalid redirect_uri"</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/python-api-authentication-by-oauth2-0-quot/m-p/1423469#M9998</link>
      <description>&lt;P&gt;This worked great for me for the most part. The only addition I needed was to add my AGOL org's URL to the 'gis' variable, otherwise, searches were performed on ALL of AGOL:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;gis = GIS('https://[MY_ORG_NAME].maps.arcgis.com', token = token) #line 24 in previous comment&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem I run into with this is, my tool using this sign-in method appears to only have access to items that have been shared to Everyone. Is there a way to give permission to an application using this authentication method to essentially have Admin access to items?&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 16:39:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/python-api-authentication-by-oauth2-0-quot/m-p/1423469#M9998</guid>
      <dc:creator>ThomasM</dc:creator>
      <dc:date>2024-05-09T16:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: Python API Authentication by OAuth2.0 "Interactive Login Experience" results in "Invalid redirect_uri"</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/python-api-authentication-by-oauth2-0-quot/m-p/1461462#M10010</link>
      <description>&lt;P&gt;As of May 13, 2024 (local Redlands, CA time), the "Interactive Login Experience" section of the &lt;A href="https://developers.arcgis.com/python/guide/working-with-different-authentication-schemes/#user-authentication-with-oauth-20" target="_self"&gt;Working with different authentication schemes&lt;/A&gt; documentation for the ArcGIS API for Python says that we should not need to get a token before instantiating the GIS object.&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2024 22:42:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/python-api-authentication-by-oauth2-0-quot/m-p/1461462#M10010</guid>
      <dc:creator>ZianChoy</dc:creator>
      <dc:date>2024-05-13T22:42:04Z</dc:date>
    </item>
  </channel>
</rss>

