<?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>Thema "Re: Rest API Script Problem" in Wertpapiere &amp; Anlage</title>
    <link>https://community.comdirect.de/t5/wertpapiere-anlage/rest-api-script-problem/m-p/256468#M160436</link>
    <description>&lt;P&gt;Vielen Dank, Jan-Ove. Ist ja auch sinnvoll, so. Werde einen anderen Weg finden.&lt;/P&gt;&lt;P&gt;Grüße,&lt;/P&gt;&lt;P&gt;Robert&lt;/P&gt;</description>
    <pubDate>Tue, 13 Dec 2022 19:07:33 GMT</pubDate>
    <dc:creator>nicknicker</dc:creator>
    <dc:date>2022-12-13T19:07:33Z</dc:date>
    <item>
      <title>Rest API Script Problem</title>
      <link>https://community.comdirect.de/t5/wertpapiere-anlage/rest-api-script-problem/m-p/256319#M160380</link>
      <description>&lt;P&gt;Hallo,&lt;/P&gt;&lt;P&gt;nachdem das bei Google Apps gut funktioniert, möchte ich ein HTML-Script zum Login schreiben, scheitere aber schon bei Schritt 1 (OAuth2 Resource Owner....). Ich habe das Script entsprechend Postman und Manual meiner Meinung nach korrekt aufgesetzt:&lt;/P&gt;&lt;P&gt;--------- Script Anfang --------------------------------&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;lt;!doctype html&amp;gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;EM&gt;&amp;lt;head&amp;gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;lt;title&amp;gt;POST Test&amp;lt;/title&amp;gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;lt;/head&amp;gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;lt;body"&amp;gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;lt;script&amp;gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;fetch("&lt;A href="https://api.comdirect.de/oauth/token" target="_blank" rel="noopener"&gt;https://api.comdirect.de/oauth/token&lt;/A&gt;", {&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; method: "POST",&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; body: "client_id=User_1234ABCD&amp;amp;client_secret=1234ABCD&amp;amp;grant_type=password&amp;amp;username=12345678&amp;amp;password=123456",&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; headers: {&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Content-Type": "application/x-www-form-urlencoded",&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "Accept": "application/json",&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; })&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .then(response =&amp;gt; response.json())&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .then(json =&amp;gt; console.log(json))&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .catch((error) =&amp;gt; console.log('error', error));&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/script&amp;gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/body&amp;gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/html&amp;gt;&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;---------- Script Ende---------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Ich kriege aber vom Comdirect server immer die Fehlermeldung&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;error TypeError: Failed to fetch&lt;BR /&gt;at file:///D:/.../post_test5.html:9:9 {stack: 'TypeError: Failed to fetch&lt;BR /&gt;at file:///D:/.../post_test5.html:9:9', message: 'Failed to fetch'}&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Wenn ich das an einen Testserver schicke (&lt;A href="https://jsonplaceholder.typicode.com/todos)" target="_blank" rel="noopener"&gt;https://jsonplaceholder.typicode.com/todos)&lt;/A&gt;&lt;/DIV&gt;&lt;DIV&gt;antwortet mir der mit einem korrekten response. Die Syntax scheint also zu stimmen.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Gibt's einen Hinweis, was korrigiert werden muß?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Viele Grüße,&lt;/DIV&gt;&lt;DIV&gt;Robert&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 12 Dec 2022 14:40:43 GMT</pubDate>
      <guid>https://community.comdirect.de/t5/wertpapiere-anlage/rest-api-script-problem/m-p/256319#M160380</guid>
      <dc:creator>nicknicker</dc:creator>
      <dc:date>2022-12-12T14:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: Rest API Script Problem</title>
      <link>https://community.comdirect.de/t5/wertpapiere-anlage/rest-api-script-problem/m-p/256443#M160425</link>
      <description>&lt;P&gt;Hallo &lt;a href="https://community.comdirect.de/t5/user/viewprofilepage/user-id/23420"&gt;@nicknicker&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ich habe mich dazu gerne für dich erkundigt. Wir lehnen entsprechende Requests, die aus einem Browser kommen, aus Sicherheitsgründen ab. Bitte erstelle daher eine Anwendung, die die Anfragen von einem Server sendet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Beste Grüße&lt;/P&gt;
&lt;P&gt;Jan-Ove&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2022 12:30:28 GMT</pubDate>
      <guid>https://community.comdirect.de/t5/wertpapiere-anlage/rest-api-script-problem/m-p/256443#M160425</guid>
      <dc:creator>SMT_Jan-Ove</dc:creator>
      <dc:date>2022-12-13T12:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: Rest API Script Problem</title>
      <link>https://community.comdirect.de/t5/wertpapiere-anlage/rest-api-script-problem/m-p/256468#M160436</link>
      <description>&lt;P&gt;Vielen Dank, Jan-Ove. Ist ja auch sinnvoll, so. Werde einen anderen Weg finden.&lt;/P&gt;&lt;P&gt;Grüße,&lt;/P&gt;&lt;P&gt;Robert&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2022 19:07:33 GMT</pubDate>
      <guid>https://community.comdirect.de/t5/wertpapiere-anlage/rest-api-script-problem/m-p/256468#M160436</guid>
      <dc:creator>nicknicker</dc:creator>
      <dc:date>2022-12-13T19:07:33Z</dc:date>
    </item>
  </channel>
</rss>

