<?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 Generate token with proxy in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/generate-token-with-proxy/m-p/411049#M37868</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could anyone tell me what should be the best way to generate token in ArcGIS for JavaScript. If I hard-code the credential information, it would be risky because other people could get my clientId and clientSecret easily. One possible way could be using the proxy, but as I add the serverUrl with app id and secret, I would still get a response that says client_id is not specified. So I am wondering if I didn't get this right or if there is a better solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The config settting is like:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN&gt;&amp;lt;serverUrl 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%2Frest%2Foauth2%2Ftoken" rel="nofollow" target="_blank"&gt;https://www.arcgis.com/sharing/rest/oauth2/token&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; clientId="&amp;lt;appid&amp;gt;"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; clientSecret="&amp;lt;secret&amp;gt;"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; matchAll="true"/&amp;gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the local request url is like:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN&gt;localhost/proxy/DotNet/proxy.ashx?&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%2Frest%2Foauth2%2Ftoken%3Fgrant_type%3Dclient_credentials%26expiration%3D20160" rel="nofollow" target="_blank"&gt;https://www.arcgis.com/sharing/rest/oauth2/token?grant_type=client_credentials&amp;amp;expiration=20160&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ps: If I put the clientId and secret within the url, it works all good.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Jun 2016 05:25:07 GMT</pubDate>
    <dc:creator>JackyCai1</dc:creator>
    <dc:date>2016-06-17T05:25:07Z</dc:date>
    <item>
      <title>Generate token with proxy</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/generate-token-with-proxy/m-p/411049#M37868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could anyone tell me what should be the best way to generate token in ArcGIS for JavaScript. If I hard-code the credential information, it would be risky because other people could get my clientId and clientSecret easily. One possible way could be using the proxy, but as I add the serverUrl with app id and secret, I would still get a response that says client_id is not specified. So I am wondering if I didn't get this right or if there is a better solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The config settting is like:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN&gt;&amp;lt;serverUrl 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%2Frest%2Foauth2%2Ftoken" rel="nofollow" target="_blank"&gt;https://www.arcgis.com/sharing/rest/oauth2/token&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; clientId="&amp;lt;appid&amp;gt;"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; clientSecret="&amp;lt;secret&amp;gt;"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; matchAll="true"/&amp;gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And the local request url is like:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN&gt;localhost/proxy/DotNet/proxy.ashx?&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%2Frest%2Foauth2%2Ftoken%3Fgrant_type%3Dclient_credentials%26expiration%3D20160" rel="nofollow" target="_blank"&gt;https://www.arcgis.com/sharing/rest/oauth2/token?grant_type=client_credentials&amp;amp;expiration=20160&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ps: If I put the clientId and secret within the url, it works all good.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jun 2016 05:25:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/generate-token-with-proxy/m-p/411049#M37868</guid>
      <dc:creator>JackyCai1</dc:creator>
      <dc:date>2016-06-17T05:25:07Z</dc:date>
    </item>
    <item>
      <title>Re: Generate token with proxy</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/generate-token-with-proxy/m-p/411050#M37869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe IdentityManager's &lt;SPAN style="font-family: 'courier new', courier;"&gt;generateToken()&lt;/SPAN&gt;?&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-identity-IdentityManager.html#generateToken" title="https://developers.arcgis.com/javascript/latest/api-reference/esri-identity-IdentityManager.html#generateToken"&gt;IdentityManager | API Reference | ArcGIS API for JavaScript 4.0&lt;/A&gt; &lt;/P&gt;&lt;P&gt;Or &lt;A href="https://developers.arcgis.com/authentication/working-with-proxies/" title="https://developers.arcgis.com/authentication/working-with-proxies/"&gt;Working with Proxy Services | ArcGIS for Developers&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jun 2016 15:26:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/generate-token-with-proxy/m-p/411050#M37869</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2016-06-17T15:26:51Z</dc:date>
    </item>
  </channel>
</rss>

