<?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 Developer Q&amp;A Forum</title>
    <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/REST-API-OAuth-Authentication-Failed-with-status-code-400/m-p/245660#M917</link>
    <description>&lt;P class="p1"&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/75658"&gt;@Hazard&lt;/a&gt;,&lt;/P&gt;
&lt;P class="p1"&gt;Thanks for your question. Just to make sure, because you didn't explicitly mention: Have you also &lt;A href="https://docs.dynatrace.com/docs/dynatrace-api/basics/dynatrace-api-authentication/account-api-authentication#create-an-oauth2-client" target="_blank" rel="noopener"&gt;&lt;SPAN class="s1"&gt;created the appropriate permissions&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;along with the client? And have you &lt;A href="https://docs.dynatrace.com/docs/shortlink/account-api-authentication#request-a-token" target="_blank" rel="noopener"&gt;&lt;SPAN class="s1"&gt;URL-encoded all values&lt;/SPAN&gt;&lt;/A&gt; in your request body? You can also use &lt;A href="https://curl.se/" target="_blank" rel="noopener"&gt;curl&lt;/A&gt; to try and see if the issue is with your Python code or if it's something else. Let us know if this helps!&lt;/P&gt;
&lt;P class="p1"&gt;Best,&lt;BR /&gt;Sarah&lt;/P&gt;</description>
    <pubDate>Wed, 15 May 2024 06:32:29 GMT</pubDate>
    <dc:creator>SarahFaustmann</dc:creator>
    <dc:date>2024-05-15T06:32:29Z</dc:date>
    <item>
      <title>REST API -OAuth Authentication Failed with status code 400</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/REST-API-OAuth-Authentication-Failed-with-status-code-400/m-p/245409#M908</link>
      <description>&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 noreferrer"&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 noreferrer"&gt;https://sso.dynatrace.com/sso/oauth2/token&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;my_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;my_headers = {"Content-Type": "application/x-www-form-urlencoded"}&lt;BR /&gt;response = requests.post(sso_url,params={},my_headers=headers,data=my_data)&lt;/P&gt;&lt;P&gt;token = response.json().get("access_token")&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2024 09:39:12 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/REST-API-OAuth-Authentication-Failed-with-status-code-400/m-p/245409#M908</guid>
      <dc:creator>Hazard</dc:creator>
      <dc:date>2024-05-13T09:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: REST API -OAuth Authentication Failed with status code 400</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/REST-API-OAuth-Authentication-Failed-with-status-code-400/m-p/245660#M917</link>
      <description>&lt;P class="p1"&gt;Hi&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/75658"&gt;@Hazard&lt;/a&gt;,&lt;/P&gt;
&lt;P class="p1"&gt;Thanks for your question. Just to make sure, because you didn't explicitly mention: Have you also &lt;A href="https://docs.dynatrace.com/docs/dynatrace-api/basics/dynatrace-api-authentication/account-api-authentication#create-an-oauth2-client" target="_blank" rel="noopener"&gt;&lt;SPAN class="s1"&gt;created the appropriate permissions&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;along with the client? And have you &lt;A href="https://docs.dynatrace.com/docs/shortlink/account-api-authentication#request-a-token" target="_blank" rel="noopener"&gt;&lt;SPAN class="s1"&gt;URL-encoded all values&lt;/SPAN&gt;&lt;/A&gt; in your request body? You can also use &lt;A href="https://curl.se/" target="_blank" rel="noopener"&gt;curl&lt;/A&gt; to try and see if the issue is with your Python code or if it's something else. Let us know if this helps!&lt;/P&gt;
&lt;P class="p1"&gt;Best,&lt;BR /&gt;Sarah&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 06:32:29 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/REST-API-OAuth-Authentication-Failed-with-status-code-400/m-p/245660#M917</guid>
      <dc:creator>SarahFaustmann</dc:creator>
      <dc:date>2024-05-15T06:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: REST API -OAuth Authentication Failed with status code 400</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/REST-API-OAuth-Authentication-Failed-with-status-code-400/m-p/245663#M918</link>
      <description>&lt;P&gt;Hi Sarah,&lt;/P&gt;&lt;P&gt;The problem has been solved. The Firewall prevented the execution of the POST request over SSO.&lt;/P&gt;&lt;P&gt;Thanks for collaboration&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 06:36:34 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/REST-API-OAuth-Authentication-Failed-with-status-code-400/m-p/245663#M918</guid>
      <dc:creator>Hazard</dc:creator>
      <dc:date>2024-05-15T06:36:34Z</dc:date>
    </item>
    <item>
      <title>Re: REST API -OAuth Authentication Failed with status code 400</title>
      <link>https://community.dynatrace.com/t5/Developer-Q-A-Forum/REST-API-OAuth-Authentication-Failed-with-status-code-400/m-p/245667#M919</link>
      <description>&lt;P&gt;Great, thanks for letting us know!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 May 2024 07:05:30 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Developer-Q-A-Forum/REST-API-OAuth-Authentication-Failed-with-status-code-400/m-p/245667#M919</guid>
      <dc:creator>SarahFaustmann</dc:creator>
      <dc:date>2024-05-15T07:05:30Z</dc:date>
    </item>
  </channel>
</rss>

