<?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: REST API -OAuth Authentication Failed with status code 400 in Dynatrace API</title>
    <link>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/245570#M3118</link>
    <description>&lt;P&gt;Hi again Hazard,&lt;/P&gt;&lt;P&gt;Adding "grant_type" it also works:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="erh_inetum_0-1715694368023.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/19818i72984CCD5083622A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="erh_inetum_0-1715694368023.png" alt="erh_inetum_0-1715694368023.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In the answer of the POST you can see the used scopes.&lt;/P&gt;&lt;P&gt;Please, be sure that the value of "scope" key contains the same scopes you have defined for the client_id on Identity &amp;amp; Access Managment &amp;gt; OAuth clients. And also be sure the client_id is the desired client_id you want to use.&lt;/P&gt;&lt;P&gt;If it doesn´t work, I'm afraid I haven´t more ideas.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Elena&lt;/P&gt;</description>
    <pubDate>Tue, 14 May 2024 13:59:19 GMT</pubDate>
    <dc:creator>erh_inetum</dc:creator>
    <dc:date>2024-05-14T13:59:19Z</dc:date>
    <item>
      <title>OAuth authentication failed with status code 400</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/245348#M3105</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;
&lt;P&gt;I have a problem using the rest api for oauth authentication.&lt;/P&gt;
&lt;P&gt;As described in your documentation I used POST in the request to the following endpoint:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://sso.dynatrace.com/sso/oauth2/token" target="_blank" rel="noopener"&gt;https://sso.dynatrace.com/sso/oauth2/token&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I executed the instructions providing all the parameters in the request body, but when I execute the request I get an http error code 400 (Bad Request).&amp;nbsp;How can I solve the problem?&amp;nbsp;The python code follows:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;import requests&lt;/P&gt;
&lt;P&gt;oauth_client = "my_oauthClient"&lt;BR /&gt;oauth_secret = "my_oauthSecret"&lt;BR /&gt;oauth_scope = "storage:events:read " \&lt;BR /&gt;"storage:buckets:read " \&lt;BR /&gt;"account-idm-write " \&lt;BR /&gt;"account-idm-read " \&lt;BR /&gt;"account-env-read " \&lt;BR /&gt;"account-env-write " \&lt;BR /&gt;"account-uac-read " \&lt;BR /&gt;"account-uac-write " \&lt;BR /&gt;"iam-policies-management " \&lt;BR /&gt;"iam:policies:write " \&lt;BR /&gt;"iam:policies:read " \&lt;BR /&gt;"iam:bindings:write " \&lt;BR /&gt;"iam:bindings:read " \&lt;BR /&gt;"iam:effective-permissions:read"&lt;/P&gt;
&lt;P&gt;oauth_resource = "my_urn:dtaccount:xxxxxxxxxxxxxx"&lt;/P&gt;
&lt;P&gt;sso_url = "&lt;A href="https://sso.dynatrace.com/sso/oauth2/token" target="_blank" rel="noopener"&gt;https://sso.dynatrace.com/sso/oauth2/token&lt;/A&gt;"&lt;/P&gt;
&lt;P&gt;data = {&lt;BR /&gt;'grant_type': '"client_credentials"',&lt;BR /&gt;'client_id': oauth_client,&lt;BR /&gt;'client_secret': oauth_secret,&lt;BR /&gt;'scope': oauth_scope,&lt;BR /&gt;'resource': oauth_resource}&lt;/P&gt;
&lt;P&gt;form_headers = {"Content-Type": "application/x-www-form-urlencoded"}&lt;BR /&gt;response = requests.post(sso_url,params={},headers=form_headers,data=data)&lt;/P&gt;
&lt;P&gt;auth_status = response.status_code&lt;/P&gt;
&lt;P&gt;assert auth_status == 200, f"OAuth authentication for DQL failed with status code {auth_status}"&lt;/P&gt;
&lt;P&gt;token = response.json().get("access_token")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 10:54:34 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/245348#M3105</guid>
      <dc:creator>Hazard</dc:creator>
      <dc:date>2024-06-07T10:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: REST API -OAuth Authentication Failed with status code 400</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/245489#M3106</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/75658"&gt;@Hazard&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I think the bearer is missing.&lt;/P&gt;&lt;P&gt;So I think the bearer must be captured as data&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="erh_inetum_0-1715662125872.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/19792iA9E435A0C2BBB353/image-size/medium?v=v2&amp;amp;px=400" role="button" title="erh_inetum_0-1715662125872.png" alt="erh_inetum_0-1715662125872.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;like you did here:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;data = {&lt;BR /&gt;'grant_type': '"client_credentials"',&lt;BR /&gt;'client_id': oauth_client,&lt;BR /&gt;'client_secret': oauth_secret,&lt;BR /&gt;'scope': oauth_scope,&lt;BR /&gt;'resource': oauth_resource}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;and pass it the value captured in the response variable:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;form_headers = {"Content-Type": "application/x-www-form-urlencoded"}&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;response&lt;/STRONG&gt; = requests.post(sso_url,params={},headers=form_headers,&lt;STRONG&gt;data=data&lt;/STRONG&gt;)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Elena.&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 04:59:49 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/245489#M3106</guid>
      <dc:creator>erh_inetum</dc:creator>
      <dc:date>2024-05-14T04:59:49Z</dc:date>
    </item>
    <item>
      <title>Re: REST API -OAuth Authentication Failed with status code 400</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/245498#M3107</link>
      <description>&lt;P&gt;Hi Elena,&lt;/P&gt;&lt;P&gt;Maybe I didn't explain myself well. My problem is that I can't get a Bearer Token. After creating the OAuth2 client, requesting the bearer token from the Dynatrace SSO system via an API call fails. This API Call fail:&lt;/P&gt;&lt;P&gt;&lt;A href="https://sso.dynatrace.com/sso/oauth2/token" target="_blank"&gt;https://sso.dynatrace.com/sso/oauth2/token&lt;/A&gt;&amp;nbsp;(POST)&lt;/P&gt;&lt;P&gt;and it gives me an http code 400 (Bad Request).&lt;/P&gt;&lt;P&gt;the python code in the previous post explains it well&lt;/P&gt;&lt;P&gt;I hope I explained myself.&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 07:46:50 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/245498#M3107</guid>
      <dc:creator>Hazard</dc:creator>
      <dc:date>2024-05-14T07:46:50Z</dc:date>
    </item>
    <item>
      <title>Re: REST API -OAuth Authentication Failed with status code 400</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/245506#M3108</link>
      <description>&lt;P&gt;Hi Hazard,&lt;/P&gt;&lt;P&gt;Could you try to add these scopes on "&lt;SPAN&gt;oauth_scope"&amp;nbsp;variable?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;settings:objects:read&lt;BR /&gt;settings:objects:write&lt;BR /&gt;settings:schemas:read&lt;BR /&gt;app-engine:apps:run&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Elena.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 08:00:37 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/245506#M3108</guid>
      <dc:creator>erh_inetum</dc:creator>
      <dc:date>2024-05-14T08:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: REST API -OAuth Authentication Failed with status code 400</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/245508#M3109</link>
      <description>&lt;P&gt;So do I have to recreate the Oauth client by adding these scopes, in addition to the ones already present? Should I try this?&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 08:12:08 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/245508#M3109</guid>
      <dc:creator>Hazard</dc:creator>
      <dc:date>2024-05-14T08:12:08Z</dc:date>
    </item>
    <item>
      <title>Re: REST API -OAuth Authentication Failed with status code 400</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/245509#M3110</link>
      <description>&lt;P&gt;Yes, I do. I would try it. With these scopes, it works for me.&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 08:17:17 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/245509#M3110</guid>
      <dc:creator>erh_inetum</dc:creator>
      <dc:date>2024-05-14T08:17:17Z</dc:date>
    </item>
    <item>
      <title>Re: REST API -OAuth Authentication Failed with status code 400</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/245510#M3111</link>
      <description>&lt;P&gt;Hi elena,&lt;/P&gt;&lt;P&gt;So, I'll recreate the Oauth Client by adding the following scopes and let you know ok?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;settings:objects:read&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;settings:objects:write&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;settings:schemas:read&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;app-engine:apps:run&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;storage:buckets:read&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;account-idm-write&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;account-idm-read&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;account-env-read&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;account-env-write&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;account-uac-read&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;account-uac-write&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;iam-policies-management&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;iam:policies:write&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;iam:policies:read&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;iam:bindings:write&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;iam:bindings:read&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;iam:effective-permissions:read&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 08:21:24 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/245510#M3111</guid>
      <dc:creator>Hazard</dc:creator>
      <dc:date>2024-05-14T08:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: REST API -OAuth Authentication Failed with status code 400</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/245511#M3112</link>
      <description>&lt;P&gt;Sure.&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 08:24:06 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/245511#M3112</guid>
      <dc:creator>erh_inetum</dc:creator>
      <dc:date>2024-05-14T08:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: REST API -OAuth Authentication Failed with status code 400</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/245520#M3115</link>
      <description>&lt;P&gt;Sorry Helena,&lt;/P&gt;&lt;P&gt;but it failed again....&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Hazard_0-1715678791944.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/19799i0901B841B46477A1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Hazard_0-1715678791944.png" alt="Hazard_0-1715678791944.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Follow Postman Request.&lt;/P&gt;&lt;P&gt;This thing is driving me crazy!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Hazard_1-1715678826410.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/19800iF3C9D769B9706AE8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Hazard_1-1715678826410.png" alt="Hazard_1-1715678826410.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 09:27:18 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/245520#M3115</guid>
      <dc:creator>Hazard</dc:creator>
      <dc:date>2024-05-14T09:27:18Z</dc:date>
    </item>
    <item>
      <title>Re: REST API -OAuth Authentication Failed with status code 400</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/245527#M3116</link>
      <description>&lt;P&gt;Hi Hazard,&lt;/P&gt;&lt;P&gt;This is my configuration on Postman and returns the bearer:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="erh_inetum_0-1715679942712.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/19801i33FF2DBA26A07FE5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="erh_inetum_0-1715679942712.png" alt="erh_inetum_0-1715679942712.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="erh_inetum_1-1715679998108.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/19802iB18FD148F7B079E9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="erh_inetum_1-1715679998108.png" alt="erh_inetum_1-1715679998108.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only difference that I see it's the "grant type" key. You could try to remove it and test if it works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 09:49:30 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/245527#M3116</guid>
      <dc:creator>erh_inetum</dc:creator>
      <dc:date>2024-05-14T09:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: REST API -OAuth Authentication Failed with status code 400</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/245532#M3117</link>
      <description>&lt;P&gt;Hi Helena,&lt;/P&gt;&lt;P&gt;I removed the "grant_type" key but I still get the same result. It doesn't provide me with the bearer.....&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Hazard_0-1715680789115.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/19803i8D5E2F8F381DAF55/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Hazard_0-1715680789115.png" alt="Hazard_0-1715680789115.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 10:00:03 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/245532#M3117</guid>
      <dc:creator>Hazard</dc:creator>
      <dc:date>2024-05-14T10:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: REST API -OAuth Authentication Failed with status code 400</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/245570#M3118</link>
      <description>&lt;P&gt;Hi again Hazard,&lt;/P&gt;&lt;P&gt;Adding "grant_type" it also works:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="erh_inetum_0-1715694368023.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/19818i72984CCD5083622A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="erh_inetum_0-1715694368023.png" alt="erh_inetum_0-1715694368023.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In the answer of the POST you can see the used scopes.&lt;/P&gt;&lt;P&gt;Please, be sure that the value of "scope" key contains the same scopes you have defined for the client_id on Identity &amp;amp; Access Managment &amp;gt; OAuth clients. And also be sure the client_id is the desired client_id you want to use.&lt;/P&gt;&lt;P&gt;If it doesn´t work, I'm afraid I haven´t more ideas.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Elena&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2024 13:59:19 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/245570#M3118</guid>
      <dc:creator>erh_inetum</dc:creator>
      <dc:date>2024-05-14T13:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: OAuth authentication failed with status code 400</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/253221#M3316</link>
      <description>&lt;P&gt;I have the same issue:&lt;BR /&gt;&lt;BR /&gt;curl --request POST '&lt;A href="https://sso.dynatrace.com/sso/oauth2/token" target="_blank"&gt;https://sso.dynatrace.com/sso/oauth2/token&lt;/A&gt;' \&lt;BR /&gt;--header 'Content-Type: application/x-www-form-urlencoded' \&lt;BR /&gt;--data-urlencode 'grant_type=client_credentials' \&lt;BR /&gt;--data-urlencode 'client_id=xx' \&lt;BR /&gt;--data-urlencode 'client_secret=xx' \&lt;BR /&gt;--data-urlencode 'resource=urn:dtaccount:xx' \&lt;BR /&gt;--data-urlencode 'scope=app-engine:apps:install app-engine:apps:run'&lt;BR /&gt;&lt;BR /&gt;{"errorCode":400,"message":"Bad Request","issueId":"WUQIHC74YTS7NMJO","error":"invalid_request","error_description":""}%&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 08:43:08 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/253221#M3316</guid>
      <dc:creator>DaveOps</dc:creator>
      <dc:date>2024-08-13T08:43:08Z</dc:date>
    </item>
    <item>
      <title>Re: OAuth authentication failed with status code 400</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/253223#M3318</link>
      <description>&lt;P&gt;When I leave out the scope and resource field a bearer is returned:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;curl --location --request POST 'https://sso.dynatrace.com/sso/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id=yy' \
--data-urlencode 'client_secret=zz'

{"scope":"app-engine:apps:install","token_type":"Bearer","expires_in":300,"access_token":"ey....&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 08:56:07 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/253223#M3318</guid>
      <dc:creator>DaveOps</dc:creator>
      <dc:date>2024-08-13T08:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: OAuth authentication failed with status code 400</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/253225#M3319</link>
      <description>&lt;P&gt;What I am missing is all the scopes that are needed for my use case to install a custom build react app via the deployment pipeline.&lt;BR /&gt;&lt;BR /&gt;app-engine:apps:install&lt;BR /&gt;app-engine:apps:run&lt;BR /&gt;app-engine:apps:delete&lt;BR /&gt;&lt;BR /&gt;What could be the reason?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 09:01:51 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/253225#M3319</guid>
      <dc:creator>DaveOps</dc:creator>
      <dc:date>2024-08-13T09:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: REST API -OAuth Authentication Failed with status code 400</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/275006#M3707</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/75658"&gt;@Hazard&lt;/a&gt;&amp;nbsp;remove the quotes around &lt;EM&gt;client_credentials&lt;/EM&gt; for the &lt;EM&gt;grant_type&lt;/EM&gt;&amp;nbsp;query parameter.&lt;/P&gt;&lt;P&gt;You had it like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="andre_vdveen_0-1744455762757.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/27516iDB17F394FDD9D8D6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="andre_vdveen_0-1744455762757.png" alt="andre_vdveen_0-1744455762757.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it should be without the "" around client_credentials, like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="andre_vdveen_1-1744455799598.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/27517iE6B114C053B9CEA9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="andre_vdveen_1-1744455799598.png" alt="andre_vdveen_1-1744455799598.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I confirmed it in Postman, with "" it breaks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Apr 2025 11:10:56 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/275006#M3707</guid>
      <dc:creator>andre_vdveen</dc:creator>
      <dc:date>2025-04-12T11:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: OAuth authentication failed with status code 400</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/278723#M3777</link>
      <description>&lt;P&gt;Maybe you have already solved, but this is for the records&lt;/P&gt;&lt;P&gt;You need to specify exactly the list of scopes that you already exactly defined during the OAuth2 client creation not new ones, you list them by space separated. If you need all of them simply omit the scope parameters then you get them all.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example on windows&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;curl -X POST "&lt;A href="https://sso.dynatrace.com/sso/oauth2/token" target="_blank" rel="noopener"&gt;https://sso.dynatrace.com/sso/oauth2/token&lt;/A&gt;" ^&lt;BR /&gt;-H "Content-Type: application/x-www-form-urlencoded" ^&lt;BR /&gt;-d "grant_type=client_credentials" ^&lt;BR /&gt;-d "scope=environment-api:entities:read" ^&lt;BR /&gt;-d "client_id=YOUR_ID" ^&lt;BR /&gt;-d "client_secret=YOUR_CLIENT°SECRET" ^&lt;BR /&gt;-d "resource=YOUR_URN"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You should get this response&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;curl -X POST "&lt;/SPAN&gt;&lt;SPAN&gt;&lt;A class="" title="Ctrl + Click to open https://sso.dynatrace.com/sso/oauth2/token in a new tab" href="https://sso.dynatrace.com/sso/oauth2/token" target="_blank" rel="noopener noreferrer"&gt;&lt;SPAN&gt;https://sso.dynatrace.com/sso/oauth2/token&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;" -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=client_credentials" -d "client_id="YOUR_CLIENT_ID" -d "client_secret="YOUR_CLIENT°SECRET" -d "resource=YOUR_URN"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;{"scope":"storage:entities:read environment-api:entities:read","token_type":"Bearer","expires_in":300,"access_token":"YOUR_BEARER_TOKEN","resource":"YOUR_URN"}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;Hope this helps&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 16:10:40 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/278723#M3777</guid>
      <dc:creator>MarwanC</dc:creator>
      <dc:date>2025-06-04T16:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: OAuth authentication failed with status code 400</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/279486#M3788</link>
      <description>&lt;P&gt;Leave the scope list out, yo will get all what you define before. This should work.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jun 2025 08:27:50 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-API/OAuth-authentication-failed-with-status-code-400/m-p/279486#M3788</guid>
      <dc:creator>MarwanC</dc:creator>
      <dc:date>2025-06-16T08:27:50Z</dc:date>
    </item>
  </channel>
</rss>

