<?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 Authorize token without user password in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/authorize-token-without-user-password/m-p/777488#M1046</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My question involves both Javascript and Python, so I'll post in both forums.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm developing an API for custom geoprocessing tasks done in Python, and I'm trying to use AGOL Oauth2 authentication to authorize users to using my API.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the flow :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) User a custom WebAppBuilder application, and logs in via his AGOL Organization&lt;/P&gt;&lt;P&gt;2) Custom Javascript code makes a requests to the custom API and appends a Token&lt;/P&gt;&lt;P&gt;3) Python then makes a request to verify if this token is valid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem here is with steps 1 and 2, 2 being the related to this forum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pseudo example&amp;nbsp; of python API:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;authenticate&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;request&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
  token &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; request&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;token &lt;SPAN class="comment token"&gt;#Or whatever other information is necessary&lt;/SPAN&gt;
  valid &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;isAuthenticated&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;token&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;#Just a pseudo example&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; valid&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; Response&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ok&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; Response&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;fail&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All I need is to Authorize the token, &lt;STRONG&gt;NOT&lt;/STRONG&gt;&amp;nbsp; Authenticate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just need the OAuth server to tell me this Token is valid and not expired.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or I'm also open to other suggestions to implement authorization in my API without requesting user credentials (as he already is logged in)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 08:44:40 GMT</pubDate>
    <dc:creator>GeoprocessamentoCarusoJR</dc:creator>
    <dc:date>2021-12-12T08:44:40Z</dc:date>
    <item>
      <title>Authorize token without user password</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/authorize-token-without-user-password/m-p/777488#M1046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My question involves both Javascript and Python, so I'll post in both forums.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm developing an API for custom geoprocessing tasks done in Python, and I'm trying to use AGOL Oauth2 authentication to authorize users to using my API.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's the flow :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) User a custom WebAppBuilder application, and logs in via his AGOL Organization&lt;/P&gt;&lt;P&gt;2) Custom Javascript code makes a requests to the custom API and appends a Token&lt;/P&gt;&lt;P&gt;3) Python then makes a request to verify if this token is valid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem here is with steps 1 and 2, 2 being the related to this forum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pseudo example&amp;nbsp; of python API:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;authenticate&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;request&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
  token &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; request&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;token &lt;SPAN class="comment token"&gt;#Or whatever other information is necessary&lt;/SPAN&gt;
  valid &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;isAuthenticated&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;token&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;#Just a pseudo example&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; valid&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; Response&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ok&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; Response&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;fail&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All I need is to Authorize the token, &lt;STRONG&gt;NOT&lt;/STRONG&gt;&amp;nbsp; Authenticate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just need the OAuth server to tell me this Token is valid and not expired.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or I'm also open to other suggestions to implement authorization in my API without requesting user credentials (as he already is logged in)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 08:44:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/authorize-token-without-user-password/m-p/777488#M1046</guid>
      <dc:creator>GeoprocessamentoCarusoJR</dc:creator>
      <dc:date>2021-12-12T08:44:40Z</dc:date>
    </item>
  </channel>
</rss>

