<?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 "Gelöst -Node.JS Authentication funktioniert nicht" in Website &amp; Apps</title>
    <link>https://community.comdirect.de/t5/website-apps/gel%C3%B6st-node-js-authentication-funktioniert-nicht/m-p/215325#M18513</link>
    <description>&lt;P&gt;So entnehme ich es 1:1 aus den Docs, resultiert in error 400. WHy, oh why?&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;PRE&gt;const axios = require('axios')
axios
&amp;nbsp; .post('https://api.comdirect.de/oauth/token', {
&amp;nbsp; &amp;nbsp; client_id: comdirect.client_id,
&amp;nbsp; &amp;nbsp; client_secret: comdirect.client_secret,
&amp;nbsp; &amp;nbsp; username: comdirect.username,
&amp;nbsp; &amp;nbsp; password: comdirect.password,
&amp;nbsp; &amp;nbsp; grant_type: 'password',
&amp;nbsp; }, {
&amp;nbsp; &amp;nbsp; &amp;nbsp; headers: {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Accept': 'application/json',
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Content-Type': 'application/x-www-form-urlencoded',
&amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; })
&amp;nbsp; .then(res =&amp;gt; {
&amp;nbsp; &amp;nbsp; console.log(`statusCode: ${res.status}`)
&amp;nbsp; &amp;nbsp; console.log(res)
&amp;nbsp; })
&amp;nbsp; .catch(error =&amp;gt; {
&amp;nbsp; &amp;nbsp; console.error(error)
&amp;nbsp; })&lt;/PRE&gt;Das ist brutal frustrierend. Etliche Varianten resultieren ebenfalls in error 400 oder wenn es auch mir falsch erscheint error 401.&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Sun, 24 Oct 2021 16:00:51 GMT</pubDate>
    <dc:creator>Jason2141234</dc:creator>
    <dc:date>2021-10-24T16:00:51Z</dc:date>
    <item>
      <title>Gelöst -Node.JS Authentication funktioniert nicht</title>
      <link>https://community.comdirect.de/t5/website-apps/gel%C3%B6st-node-js-authentication-funktioniert-nicht/m-p/215325#M18513</link>
      <description>&lt;P&gt;So entnehme ich es 1:1 aus den Docs, resultiert in error 400. WHy, oh why?&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;PRE&gt;const axios = require('axios')
axios
&amp;nbsp; .post('https://api.comdirect.de/oauth/token', {
&amp;nbsp; &amp;nbsp; client_id: comdirect.client_id,
&amp;nbsp; &amp;nbsp; client_secret: comdirect.client_secret,
&amp;nbsp; &amp;nbsp; username: comdirect.username,
&amp;nbsp; &amp;nbsp; password: comdirect.password,
&amp;nbsp; &amp;nbsp; grant_type: 'password',
&amp;nbsp; }, {
&amp;nbsp; &amp;nbsp; &amp;nbsp; headers: {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Accept': 'application/json',
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 'Content-Type': 'application/x-www-form-urlencoded',
&amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; })
&amp;nbsp; .then(res =&amp;gt; {
&amp;nbsp; &amp;nbsp; console.log(`statusCode: ${res.status}`)
&amp;nbsp; &amp;nbsp; console.log(res)
&amp;nbsp; })
&amp;nbsp; .catch(error =&amp;gt; {
&amp;nbsp; &amp;nbsp; console.error(error)
&amp;nbsp; })&lt;/PRE&gt;Das ist brutal frustrierend. Etliche Varianten resultieren ebenfalls in error 400 oder wenn es auch mir falsch erscheint error 401.&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 24 Oct 2021 16:00:51 GMT</pubDate>
      <guid>https://community.comdirect.de/t5/website-apps/gel%C3%B6st-node-js-authentication-funktioniert-nicht/m-p/215325#M18513</guid>
      <dc:creator>Jason2141234</dc:creator>
      <dc:date>2021-10-24T16:00:51Z</dc:date>
    </item>
    <item>
      <title>Betreff: Node.JS Authentication funktioniert nicht</title>
      <link>https://community.comdirect.de/t5/website-apps/gel%C3%B6st-node-js-authentication-funktioniert-nicht/m-p/215340#M18514</link>
      <description>&lt;P&gt;Na gut, dank Postman das ganze doch nach entwurschtelt.&lt;/P&gt;&lt;P&gt;Urlencoded bedarf einem anderen Parameter pass in axios -.-&lt;/P&gt;&lt;P&gt;Cookie ist hier nicht nötig, aber wird später wichtig, insofern hier einfach mal der ganze Code, guid ist aus dem Postman JSON, nicht von mir.&lt;/P&gt;&lt;P&gt;Vielleicht hilft es einem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;// Generate a GUID for this session only
function guid() {
    function _p8(s) {
        var p = (Math.random().toString(16)+"000000000").substr(2,8);
        return s ? "-" + p.substr(0,4) + "-" + p.substr(4,4) : p ;
    }
    return _p8() + _p8(true) + _p8(true) + _p8();
}

const axios = require('axios')

const params = new URLSearchParams();
params.append('client_id', comdirect.client_id);
params.append('client_secret', comdirect.client_secret);
params.append('grant_type', 'password');
params.append('username', comdirect.username);
params.append('password', comdirect.password);

axios
  .post('https://api.comdirect.de/oauth/token', params, {
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/x-www-form-urlencoded',
        'Cookie': guid(),
      }
  })
  .then(res =&amp;gt; {
    console.log(`statusCode: ${res.status}`)
    console.log(res)
  })
  .catch(error =&amp;gt; {
    console.error(error)
  })&lt;/PRE&gt;</description>
      <pubDate>Sun, 24 Oct 2021 15:59:43 GMT</pubDate>
      <guid>https://community.comdirect.de/t5/website-apps/gel%C3%B6st-node-js-authentication-funktioniert-nicht/m-p/215340#M18514</guid>
      <dc:creator>Jason2141234</dc:creator>
      <dc:date>2021-10-24T15:59:43Z</dc:date>
    </item>
  </channel>
</rss>

