<?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 generate token? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-generate-token/m-p/340980#M31571</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello I am following the guide php and javascript to generate token's &lt;A href="https://developers.arcgis.com/authentication/accessing-arcgis-online-services/#registering-your-application" title="https://developers.arcgis.com/authentication/accessing-arcgis-online-services/#registering-your-application" rel="nofollow noopener noreferrer" target="_blank"&gt;Implementing App Login | ArcGIS for Developers&lt;/A&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;but I can not do not know what is missing me.&lt;/P&gt;&lt;P&gt;I registered an application and set the CLIENT_ID and client_secret:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;lt;?php
$params = array(
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'client_id' =&amp;gt; "15yv5x0SU52gG9vU",
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'client_secret' =&amp;gt; "24550d44d4aa4f7d9525ae9143289ede",
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'grant_type' =&amp;gt; 'client_credentials',
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'f' =&amp;gt; 'json'
);


try {
&amp;nbsp;&amp;nbsp;&amp;nbsp; $ch = curl_init();
&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; curl_setopt($ch, CURLOPT_URL, "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fwww.arcgis.com%2Fsharing%2Foauth2%2Ftoken%2F" target="_blank"&gt;https://www.arcgis.com/sharing/oauth2/token/&lt;/A&gt;&lt;SPAN&gt;");&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; curl_setopt($ch, CURLOPT_POST, true);
&amp;nbsp;&amp;nbsp;&amp;nbsp; curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
&amp;nbsp;&amp;nbsp;&amp;nbsp; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
&amp;nbsp;&amp;nbsp;&amp;nbsp; curl_setopt($ch, CURLOPT_HEADER, true);
&amp;nbsp;&amp;nbsp;&amp;nbsp; $response = curl_exec($ch);
} catch (Exception $e) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; error_log($e-&amp;gt;getMessage(), 0);
}


$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$body = substr($response, $header_size);
$json = json_decode($body, true);
$token = $json['access_token'];
var_dump($token);&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 16:07:01 GMT</pubDate>
    <dc:creator>CloudingSoft</dc:creator>
    <dc:date>2021-12-11T16:07:01Z</dc:date>
    <item>
      <title>how generate token?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-generate-token/m-p/340980#M31571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello I am following the guide php and javascript to generate token's &lt;A href="https://developers.arcgis.com/authentication/accessing-arcgis-online-services/#registering-your-application" title="https://developers.arcgis.com/authentication/accessing-arcgis-online-services/#registering-your-application" rel="nofollow noopener noreferrer" target="_blank"&gt;Implementing App Login | ArcGIS for Developers&lt;/A&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;but I can not do not know what is missing me.&lt;/P&gt;&lt;P&gt;I registered an application and set the CLIENT_ID and client_secret:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;lt;?php
$params = array(
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'client_id' =&amp;gt; "15yv5x0SU52gG9vU",
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'client_secret' =&amp;gt; "24550d44d4aa4f7d9525ae9143289ede",
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'grant_type' =&amp;gt; 'client_credentials',
&amp;nbsp;&amp;nbsp;&amp;nbsp; 'f' =&amp;gt; 'json'
);


try {
&amp;nbsp;&amp;nbsp;&amp;nbsp; $ch = curl_init();
&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; curl_setopt($ch, CURLOPT_URL, "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fwww.arcgis.com%2Fsharing%2Foauth2%2Ftoken%2F" target="_blank"&gt;https://www.arcgis.com/sharing/oauth2/token/&lt;/A&gt;&lt;SPAN&gt;");&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; curl_setopt($ch, CURLOPT_POST, true);
&amp;nbsp;&amp;nbsp;&amp;nbsp; curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
&amp;nbsp;&amp;nbsp;&amp;nbsp; curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
&amp;nbsp;&amp;nbsp;&amp;nbsp; curl_setopt($ch, CURLOPT_HEADER, true);
&amp;nbsp;&amp;nbsp;&amp;nbsp; $response = curl_exec($ch);
} catch (Exception $e) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; error_log($e-&amp;gt;getMessage(), 0);
}


$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$body = substr($response, $header_size);
$json = json_decode($body, true);
$token = $json['access_token'];
var_dump($token);&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:07:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-generate-token/m-p/340980#M31571</guid>
      <dc:creator>CloudingSoft</dc:creator>
      <dc:date>2021-12-11T16:07:01Z</dc:date>
    </item>
  </channel>
</rss>

