<?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: 400 Bad Request when Getting Token for client_credentials Request on Private Server in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/400-bad-request-when-getting-token-for-client/m-p/1655774#M7610</link>
    <description>&lt;P&gt;&lt;A href="https://developers.arcgis.com/documentation/security-and-authentication/reference/rest-authentication-operations/" target="_blank"&gt;https://developers.arcgis.com/documentation/security-and-authentication/reference/rest-authentication-operations/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HildermesJosMedeirosFilho_0-1759839137269.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/141443i73A1DAEA19D7CFA1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HildermesJosMedeirosFilho_0-1759839137269.png" alt="HildermesJosMedeirosFilho_0-1759839137269.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HildermesJosMedeirosFilho_1-1759839159979.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/141444iFF92925A3E6F2EE2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HildermesJosMedeirosFilho_1-1759839159979.png" alt="HildermesJosMedeirosFilho_1-1759839159979.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I would double check if you mispelled something in the code, if you did you get 200, but a page...in html&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HildermesJosMedeirosFilho_3-1759839433338.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/141446iBE3531E2DAA889D2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HildermesJosMedeirosFilho_3-1759839433338.png" alt="HildermesJosMedeirosFilho_3-1759839433338.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You can pass format json to get the proper error code.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HildermesJosMedeirosFilho_2-1759839379248.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/141445i7DE43F291F6AD83F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HildermesJosMedeirosFilho_2-1759839379248.png" alt="HildermesJosMedeirosFilho_2-1759839379248.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;If I`m not mistaken the api is jsonp compliant unless turned off&lt;BR /&gt;&lt;A href="https://developers.arcgis.com/rest/enterprise-administration/server/handlersrestservicesdirectoryedit/" target="_blank"&gt;https://developers.arcgis.com/rest/enterprise-administration/server/handlersrestservicesdirectoryedit/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HildermesJosMedeirosFilho_4-1759839566387.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/141447i74F279BDF30DD641/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HildermesJosMedeirosFilho_4-1759839566387.png" alt="HildermesJosMedeirosFilho_4-1759839566387.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Oct 2025 12:20:18 GMT</pubDate>
    <dc:creator>HildermesJoséMedeirosFilho</dc:creator>
    <dc:date>2025-10-07T12:20:18Z</dc:date>
    <item>
      <title>400 Bad Request when Getting Token for client_credentials Request on Private Server</title>
      <link>https://community.esri.com/t5/developers-questions/400-bad-request-when-getting-token-for-client/m-p/1653645#M7603</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have been using the ArcGis Online auth service with some web maps and now we're migrating to our own internal server.&amp;nbsp; We're using client_credentials, so a typical URL would look like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://community.esri.com/" target="_blank"&gt;https://www.arcgis.com/sharing/rest/oauth2/token?client_id=&amp;lt;clientId&amp;gt;&amp;amp;client_secret=&amp;lt;client_secret&amp;gt;&lt;/A&gt;&amp;amp;grant_type=client_credentials&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;On our server, the portal URL is&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://our.internal.url.com/portal/" target="_blank"&gt;https://our.internal.url.com/portal/&lt;/A&gt;.&amp;nbsp; So, our auth URL should be (if I'm correct):&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://our.internal.url.com/portal/" target="_blank"&gt;https://our.internal.url.com/portal/sharing/rest/oath2/token?client_id=&amp;lt;client_id&amp;gt;&amp;amp;client_secret=&amp;lt;client_secret&amp;gt;&amp;amp;grant_type=client_credentials&lt;/A&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However, when I hit that, I get 400 Bad Request with the message "Error: Invalid URL".&amp;nbsp; What am I doing wrong? 400 Bad Request means it's able to access the URL, so I don't think it's an access or routing issue... but no clue what else to check or try.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Sep 2025 22:29:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/400-bad-request-when-getting-token-for-client/m-p/1653645#M7603</guid>
      <dc:creator>RockyCherry</dc:creator>
      <dc:date>2025-09-26T22:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: 400 Bad Request when Getting Token for client_credentials Request on Private Server</title>
      <link>https://community.esri.com/t5/developers-questions/400-bad-request-when-getting-token-for-client/m-p/1655774#M7610</link>
      <description>&lt;P&gt;&lt;A href="https://developers.arcgis.com/documentation/security-and-authentication/reference/rest-authentication-operations/" target="_blank"&gt;https://developers.arcgis.com/documentation/security-and-authentication/reference/rest-authentication-operations/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HildermesJosMedeirosFilho_0-1759839137269.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/141443i73A1DAEA19D7CFA1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HildermesJosMedeirosFilho_0-1759839137269.png" alt="HildermesJosMedeirosFilho_0-1759839137269.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HildermesJosMedeirosFilho_1-1759839159979.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/141444iFF92925A3E6F2EE2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HildermesJosMedeirosFilho_1-1759839159979.png" alt="HildermesJosMedeirosFilho_1-1759839159979.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I would double check if you mispelled something in the code, if you did you get 200, but a page...in html&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HildermesJosMedeirosFilho_3-1759839433338.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/141446iBE3531E2DAA889D2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HildermesJosMedeirosFilho_3-1759839433338.png" alt="HildermesJosMedeirosFilho_3-1759839433338.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You can pass format json to get the proper error code.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HildermesJosMedeirosFilho_2-1759839379248.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/141445i7DE43F291F6AD83F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HildermesJosMedeirosFilho_2-1759839379248.png" alt="HildermesJosMedeirosFilho_2-1759839379248.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;If I`m not mistaken the api is jsonp compliant unless turned off&lt;BR /&gt;&lt;A href="https://developers.arcgis.com/rest/enterprise-administration/server/handlersrestservicesdirectoryedit/" target="_blank"&gt;https://developers.arcgis.com/rest/enterprise-administration/server/handlersrestservicesdirectoryedit/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="HildermesJosMedeirosFilho_4-1759839566387.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/141447i74F279BDF30DD641/image-size/medium?v=v2&amp;amp;px=400" role="button" title="HildermesJosMedeirosFilho_4-1759839566387.png" alt="HildermesJosMedeirosFilho_4-1759839566387.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Oct 2025 12:20:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/400-bad-request-when-getting-token-for-client/m-p/1655774#M7610</guid>
      <dc:creator>HildermesJoséMedeirosFilho</dc:creator>
      <dc:date>2025-10-07T12:20:18Z</dc:date>
    </item>
  </channel>
</rss>

