<?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 to Generate Token By URL Request From ArcGIS Portal in ArcGIS Enterprise Portal Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/how-to-generate-token-by-url-request-from-arcgis/m-p/110058#M1341</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: #242729; background-color: rgba(248, 248, 248, 0.6); border: 0px; margin: 0px 0px 1em;"&gt;I am able to create token from&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE style="background-color: #eff0f1; border: 0px; font-weight: inherit; font-size: 13px; padding: 1px 5px;"&gt;Generate Token&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;operation on ArcGIS Portal Directory using IP Address of this request's origin parameter like&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://i.stack.imgur.com/qTNJL.png" rel="nofollow noreferrer" style="color: #358daa; border: 0px; font-weight: inherit; text-decoration: none; font-size: inherit;"&gt;&lt;IMG alt="enter image description here" src="https://i.stack.imgur.com/qTNJL.png" style="border: 0px; font-weight: inherit; font-size: inherit;" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P style="color: #242729; background-color: rgba(248, 248, 248, 0.6); border: 0px; margin: 0px 0px 1em;"&gt;but when I try to achive the token from URL like&lt;/P&gt;&lt;PRE style="color: #242729; background-color: #eff0f1; border: 0px; font-size: 13px; margin: 0px 0px 1em; padding: 5px;"&gt;&lt;CODE style="background-color: #eff0f1; border: 0px; font-weight: inherit; font-size: 13px;"&gt;https://map.geoca.com/portal/sharing/rest/generateToken?username=mapAdmin&amp;amp;password=psw&amp;amp;referer=https://map.geoca.com&amp;amp;f=json&lt;/CODE&gt;&lt;/PRE&gt;&lt;P style="color: #242729; background-color: rgba(248, 248, 248, 0.6); border: 0px; margin: 0px 0px 1em;"&gt;I am getting this error message&lt;/P&gt;&lt;BLOCKQUOTE class="jive-quote" style="color: #242729; background-color: #eeeeee; border-style: initial initial initial solid; border-color: initial initial initial transparent; margin: 0px 0px 10px; padding: 10px;"&gt;&lt;P style="border: 0px; font-weight: inherit; font-size: inherit;"&gt;{"error":{"code":405,"messageCode":"GWM_0005","message":"Method not supported.","details":[]}}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P style="color: #242729; background-color: rgba(248, 248, 248, 0.6); border: 0px; margin: 0px 0px 1em;"&gt;can you please let me know how I can fix this to get the token?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Nov 2017 22:05:54 GMT</pubDate>
    <dc:creator>BehrouzHosseini</dc:creator>
    <dc:date>2017-11-21T22:05:54Z</dc:date>
    <item>
      <title>How to Generate Token By URL Request From ArcGIS Portal</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/how-to-generate-token-by-url-request-from-arcgis/m-p/110058#M1341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: #242729; background-color: rgba(248, 248, 248, 0.6); border: 0px; margin: 0px 0px 1em;"&gt;I am able to create token from&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE style="background-color: #eff0f1; border: 0px; font-weight: inherit; font-size: 13px; padding: 1px 5px;"&gt;Generate Token&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;operation on ArcGIS Portal Directory using IP Address of this request's origin parameter like&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://i.stack.imgur.com/qTNJL.png" rel="nofollow noreferrer" style="color: #358daa; border: 0px; font-weight: inherit; text-decoration: none; font-size: inherit;"&gt;&lt;IMG alt="enter image description here" src="https://i.stack.imgur.com/qTNJL.png" style="border: 0px; font-weight: inherit; font-size: inherit;" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P style="color: #242729; background-color: rgba(248, 248, 248, 0.6); border: 0px; margin: 0px 0px 1em;"&gt;but when I try to achive the token from URL like&lt;/P&gt;&lt;PRE style="color: #242729; background-color: #eff0f1; border: 0px; font-size: 13px; margin: 0px 0px 1em; padding: 5px;"&gt;&lt;CODE style="background-color: #eff0f1; border: 0px; font-weight: inherit; font-size: 13px;"&gt;https://map.geoca.com/portal/sharing/rest/generateToken?username=mapAdmin&amp;amp;password=psw&amp;amp;referer=https://map.geoca.com&amp;amp;f=json&lt;/CODE&gt;&lt;/PRE&gt;&lt;P style="color: #242729; background-color: rgba(248, 248, 248, 0.6); border: 0px; margin: 0px 0px 1em;"&gt;I am getting this error message&lt;/P&gt;&lt;BLOCKQUOTE class="jive-quote" style="color: #242729; background-color: #eeeeee; border-style: initial initial initial solid; border-color: initial initial initial transparent; margin: 0px 0px 10px; padding: 10px;"&gt;&lt;P style="border: 0px; font-weight: inherit; font-size: inherit;"&gt;{"error":{"code":405,"messageCode":"GWM_0005","message":"Method not supported.","details":[]}}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P style="color: #242729; background-color: rgba(248, 248, 248, 0.6); border: 0px; margin: 0px 0px 1em;"&gt;can you please let me know how I can fix this to get the token?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Nov 2017 22:05:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/how-to-generate-token-by-url-request-from-arcgis/m-p/110058#M1341</guid>
      <dc:creator>BehrouzHosseini</dc:creator>
      <dc:date>2017-11-21T22:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to Generate Token By URL Request From ArcGIS Portal</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/how-to-generate-token-by-url-request-from-arcgis/m-p/110059#M1342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Benji,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When adding the URL to a web browser, I believe it is using a 'GET' rather than a 'POST'.&amp;nbsp; You will need to use a POST to generate the token.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could achieve this using python:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; urllib&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; urllib2&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; json&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; ssl

username &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"portaladmin"&lt;/SPAN&gt;
password &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"gis12345"&lt;/SPAN&gt;

tokenURL &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fportal.domain.com%2Fportal%2Fsharing%2Frest%2FgenerateToken%2F" target="_blank"&gt;https://portal.domain.com/portal/sharing/rest/generateToken/&lt;/A&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;/SPAN&gt;
params &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'f'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'pjson'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'username'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; username&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'password'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; password&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'referer'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fportal.domain.com" target="_blank"&gt;https://portal.domain.com&lt;/A&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
req &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; urllib2&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Request&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;tokenURL&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; urllib&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;urlencode&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;params&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;try&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; response &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; urllib2&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;urlopen&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;req&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;except&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; gcontext &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; ssl&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SSLContext&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;ssl&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;PROTOCOL_TLSv1&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; response &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; urllib2&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;urlopen&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;req&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; context&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;gcontext&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
data &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; json&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;load&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;response&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
token &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; data&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'token'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;token&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:36:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/how-to-generate-token-by-url-request-from-arcgis/m-p/110059#M1342</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T06:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to Generate Token By URL Request From ArcGIS Portal</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/how-to-generate-token-by-url-request-from-arcgis/m-p/110060#M1343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/8586"&gt;Jake Skinner&lt;/A&gt;&amp;nbsp; &amp;nbsp;I'm trying your code out, but getting an error on the&amp;nbsp; &amp;nbsp;ssl.SSLContext line12&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt; Python Shell, prompt 32, line 12&lt;BR /&gt;AttributeError: 'module' object has no attribute 'SSLContext'&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried it in WingPro and in ArcGIS Desktop 10.3.1....maybe a Python version issue?&amp;nbsp; I'm using a modified version you posted a while back for working with my ArcGIS Server, but it did not have ssl in the code that I can see.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Nov 2017 01:20:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/how-to-generate-token-by-url-request-from-arcgis/m-p/110060#M1343</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2017-11-23T01:20:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to Generate Token By URL Request From ArcGIS Portal</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/how-to-generate-token-by-url-request-from-arcgis/m-p/110061#M1344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/people/rastrauch"&gt;rastrauch&lt;/A&gt;‌, would you be able to provide the code you tried?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2017 12:03:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/how-to-generate-token-by-url-request-from-arcgis/m-p/110061#M1344</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2017-11-29T12:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to Generate Token By URL Request From ArcGIS Portal</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/how-to-generate-token-by-url-request-from-arcgis/m-p/110062#M1345</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.esri.com/migrated-users/8586"&gt;Jake Skinner&lt;/A&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I worked with it again, and I did get it working. (with your code above)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the error above was either my system just needed a reboot, or may have been the fact that our portal might not have been completely setup correctly.&amp;nbsp; We had to reauthorize and re-set our web adaptor yesterday as we are finally getting 10.5.1 tested.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, when I tried this morning, I was getting a different error.... (ValueError: No JSON object could be decoded) but that was because&amp;nbsp;I was using the URL without the full domain name.&amp;nbsp; (for both the tokenURL and params referer).&amp;nbsp; Once I put the&amp;nbsp; &amp;lt;portal&amp;gt;.&amp;lt;domain&amp;gt;.local in, it worked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tested in both Wing Pro and ArcCatalog 10.5.1 and it is returning a token for me now.&amp;nbsp; Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Nov 2017 18:48:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/how-to-generate-token-by-url-request-from-arcgis/m-p/110062#M1345</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2017-11-29T18:48:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to Generate Token By URL Request From ArcGIS Portal</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/how-to-generate-token-by-url-request-from-arcgis/m-p/110063#M1346</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for sharing the script. I tested this in two environments. The script worked fine in env where SSL was set to False and gave the following error message for env with SSL = true:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Runtime error &lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt; File "&amp;lt;string&amp;gt;", line 12, in &amp;lt;module&amp;gt;&lt;BR /&gt;AttributeError: 'module' object has no attribute 'SSLContext'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--Are we suppose to make any change in the script for env with SSL-True.?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Sep 2019 06:50:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/how-to-generate-token-by-url-request-from-arcgis/m-p/110063#M1346</guid>
      <dc:creator>ManviLather</dc:creator>
      <dc:date>2019-09-27T06:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to Generate Token By URL Request From ArcGIS Portal</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/how-to-generate-token-by-url-request-from-arcgis/m-p/110064#M1347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try the following script that uses the requests module instead.&amp;nbsp; The &lt;EM&gt;&lt;STRONG&gt;server&lt;/STRONG&gt;&lt;/EM&gt; variable is the name of the server where portal is installed (not the web adaptor):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; requests&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; json

&lt;SPAN class="comment token"&gt;# Disable warnings&lt;/SPAN&gt;
requests&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;packages&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;urllib3&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;disable_warnings&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

username &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"gis\jskinner"&lt;/SPAN&gt;
password &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"*******"&lt;/SPAN&gt;
server &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; "portal&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;esri&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;com

tokenURL &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'https://{0}:7443/arcgis/sharing/rest/generateToken/'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;server&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
params &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'f'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'pjson'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'username'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; username&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'password'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; password&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'referer'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'https://{0}'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;server&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;

r &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; requests&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;post&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;tokenURL&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; data &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; params&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; verify&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token boolean"&gt;False&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
response &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; json&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;loads&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;content&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
token &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; response&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'token'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;token&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:36:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/how-to-generate-token-by-url-request-from-arcgis/m-p/110064#M1347</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T06:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to Generate Token By URL Request From ArcGIS Portal</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/how-to-generate-token-by-url-request-from-arcgis/m-p/110065#M1348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/8586" target="_blank"&gt;Jake Skinner&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thanks you for the alternative.&amp;nbsp; I'm converting a script I had working in 2.7.&amp;nbsp; With requests I'm able to generate a token but getting an error message when i try to query the service to see when a point was added.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error is :&amp;nbsp;&amp;nbsp;TypeError: the JSON object must be str, bytes or bytearray, not 'dict'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the bit of code giving me problems. Any thoughts?&amp;nbsp; Thank you!&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# Query service and check if created_date time &lt;/SPAN&gt;
params &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'f'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'pjson'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'where'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"1=1"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'outfields'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'OBJECTID_1, AssetID, Status, Location, Notes '&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'returnGeometry'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'false'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'token'&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; token&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
req &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; requests&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;post&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;tokenURL&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; data&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;params&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; verify&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token boolean"&gt;False&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
response &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;json&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;loads&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;req&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;content&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
data &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; json&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;loads&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;response&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; feat &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; data&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'features'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
Status &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; feat&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'attributes'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Status'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; Status &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;6&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
oidList&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;append&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;feat&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'attributes'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;uniqueID&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
AssetID&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;append&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;feat&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'attributes'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'AssetID'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
Location&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;append&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;feat&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'attributes'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Location'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
Notes&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;append&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;feat&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'attributes'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'Notes'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:36:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/how-to-generate-token-by-url-request-from-arcgis/m-p/110065#M1348</guid>
      <dc:creator>maryandrews</dc:creator>
      <dc:date>2021-12-11T06:36:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to Generate Token By URL Request From ArcGIS Portal</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/how-to-generate-token-by-url-request-from-arcgis/m-p/110066#M1349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/7497"&gt;mary andrews&lt;/A&gt;‌ it looks like the &lt;STRONG&gt;data &lt;/STRONG&gt;variable is set to the response of the tokenURL requests.&amp;nbsp; You will need another request to the feature service URL.&amp;nbsp; Take a look at the following &lt;A _jive_internal="true" href="https://community.esri.com/docs/DOC-10163-send-email-when-a-feature-is-added-to-an-arcgis-online-hosted-feature-service"&gt;document &lt;/A&gt;on sending an e-mail when a feature is added.&amp;nbsp; It should give you an idea on how to generate a token, and then query a service.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Dec 2019 18:16:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/how-to-generate-token-by-url-request-from-arcgis/m-p/110066#M1349</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2019-12-26T18:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to Generate Token By URL Request From ArcGIS Portal</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/how-to-generate-token-by-url-request-from-arcgis/m-p/1132558#M11882</link>
      <description>&lt;P&gt;Hi Jake,&lt;BR /&gt;I'm seeing the exact same error when requesting token from WAB. I've inherited the code from previous developer and I'm seeing this token url being generated in the code in ConfigLoader and tokenUtils files in jimu folder.&lt;BR /&gt;The URL is&amp;nbsp;&lt;A href="https://maps.ecosphere.fws.gov/portal/sharing/generateToken?f=json&amp;amp;username=abc&amp;amp;password=xyz&amp;amp;client=referer&amp;amp;referer=" target="_blank"&gt;https://maps.ecosphere.fws.gov/portal/sharing/generateToken?f=json&amp;amp;username=abc&amp;amp;password=xyz&amp;amp;client=referer&amp;amp;referer=&lt;/A&gt;&lt;A href="https://myserver/mywebapp&amp;amp;expiration=60&amp;amp;callback=dojo_request_script_callbacks.dojo_request_script0" target="_blank"&gt;https://myserver/mywebapp&amp;amp;expiration=60&amp;amp;callback=dojo_request_script_callbacks.dojo_request_script0&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Any idea how callback is being appended to the url? Also wondering how to use POST method to generate token in WAB. Any help is greatly appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jan 2022 18:59:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/how-to-generate-token-by-url-request-from-arcgis/m-p/1132558#M11882</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-01-11T18:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to Generate Token By URL Request From ArcGIS Portal</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/how-to-generate-token-by-url-request-from-arcgis/m-p/1278774#M13378</link>
      <description>&lt;P&gt;Hi, I have the same problem. Did you solve it?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2023 14:09:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/how-to-generate-token-by-url-request-from-arcgis/m-p/1278774#M13378</guid>
      <dc:creator>CarlosCampillo</dc:creator>
      <dc:date>2023-04-14T14:09:08Z</dc:date>
    </item>
  </channel>
</rss>

