<?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 "Betreff: Problems getting the access token" in Getting started programming with the Viessmann API</title>
    <link>https://community.viessmann.de/t5/Getting-started-programming-with/Problems-getting-the-access-token/m-p/193919#M108</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a bit puzzled... I also get "invalid-token-request" when trying this on the command line.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my script:&lt;/P&gt;&lt;P&gt;#!/bin/bash&lt;/P&gt;&lt;P&gt;export client_id="client_id"&lt;BR /&gt;export redirect_uri="&lt;A href="http://localhost:4200/oauth-callback" target="_blank"&gt;http://localhost:4200/oauth-callback&lt;/A&gt;"&lt;BR /&gt;export challenge_id=$(cat /proc/sys/kernel/random/uuid)&lt;BR /&gt;export email="email"&lt;BR /&gt;export password="password"&lt;/P&gt;&lt;P&gt;# Authorize and get code for further request&lt;BR /&gt;curl -X POST "&lt;A href="https://iam.viessmann.com/idp/v2/authorize?client_id=$client_id&amp;amp;redirect_uri=$redirect_uri&amp;amp;response_type=code&amp;amp;code_challenge=$challenge_id&amp;amp;scope=IoT%20User" target="_blank"&gt;https://iam.viessmann.com/idp/v2/authorize?client_id=$client_id&amp;amp;redirect_uri=$redirect_uri&amp;amp;response_type=code&amp;amp;code_challenge=$challenge_id&amp;amp;scope=IoT%20User&lt;/A&gt;" \&lt;BR /&gt;-d "hidden-password=00&amp;amp;stayloggedin=Angemeldet bleiben&amp;amp;submit=Login&amp;amp;isiwebuserid=$email&amp;amp;isiwebpasswd=$password" \&lt;BR /&gt;-o login.html&lt;BR /&gt;export code=$(grep $redirect_uri login.html | sed -E 's/(^.*code=)([^"]*)(.*)/\2/g')&lt;/P&gt;&lt;P&gt;# get access token&lt;BR /&gt;curl -H "Content-Type: application/x-www-form-urlencoded" \&lt;BR /&gt;-X POST "&lt;A href="https://iam.viessmann.com/idp/v2/token" target="_blank"&gt;https://iam.viessmann.com/idp/v2/token&lt;/A&gt;" \&lt;BR /&gt;-d "grant_type=authorization_code&amp;amp;code_verifier=$challenge_id&amp;amp;client_id=$client_id&amp;amp;redirect_uri=$redirect_uri&amp;amp;code=$code" \&lt;BR /&gt;-o access_token.json&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am I missing somehting and cannot see it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 02 Nov 2021 10:23:12 GMT</pubDate>
    <dc:creator>MrAnderson</dc:creator>
    <dc:date>2021-11-02T10:23:12Z</dc:date>
    <item>
      <title>Problems getting the access token</title>
      <link>https://community.viessmann.de/t5/Getting-started-programming-with/Problems-getting-the-access-token/m-p/178578#M86</link>
      <description>&lt;P&gt;I am observing problems getting the access token as described in the developer portal.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Intitially I am trying to get the token manually by http requests in order to understand the procedure, the final goal is to implement the whole procedure into &lt;STRONG&gt;openHAB&lt;/STRONG&gt; using rules and later &lt;STRONG&gt;maybe&lt;/STRONG&gt;&amp;nbsp;a complete binding (i.e. create a standard interface from openHAB to the Viessmann API useable for others as well).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My current problem/question:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I managed to get past Step 1 and received a code using the posted http request like:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="hljs-attribute"&gt;&lt;A href="https://iam.viessmann.com/idp/v2/authorize?" target="_blank" rel="noopener"&gt;https://iam.viessmann.com/idp/v2/authorize?&lt;/A&gt;client_id=&lt;SPAN class="highlight"&gt;my_oauth_client_id&lt;/SPAN&gt;&amp;amp;redirect_uri=&lt;SPAN class="highlight"&gt;http://localhost:4200/&lt;/SPAN&gt;&amp;amp;response_type=code&amp;amp;code_challenge=&lt;SPAN class="highlight"&gt;my_code_challenge&lt;/SPAN&gt;&amp;amp;scope=IoT%20User&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;(my_oauth_client and&amp;nbsp;my_code_challenge are replaced with my actual values).&lt;/P&gt;&lt;P&gt;Using the received code I posted:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="hljs-attribute"&gt;&lt;A href="https://iam.viessmann.com/idp/v2/token?client_id=my_oauth_client&amp;amp;redirect_uri=http://localhost:4200/&amp;amp;code_verifier=my_code_challenge&amp;amp;code=my_received_code" target="_blank" rel="noopener"&gt;https://iam.viessmann.com/idp/v2/token?client_id=my_oauth_client&amp;amp;redirect_uri=http://localhost:4200/&amp;amp;code_verifier=my_code_challenge&amp;amp;code=my_received_code&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I used the same string for My_code_challenge in both cases (in my understanding without setting&amp;nbsp;&lt;EM&gt;code_challenge_method &lt;/EM&gt;this should be correct).&lt;/P&gt;&lt;P&gt;From such I always get:&lt;/P&gt;&lt;PRE&gt;{"error":"invalid-authorization-request"}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I tried to send the second request as fast as possible (at least within a minute). Am I to slow?&lt;/LI&gt;&lt;LI&gt;The developer portal showed only a cURL example for the second request, is my selfmade https string wrong?&lt;/LI&gt;&lt;LI&gt;....&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;As a follow up question, the to be received API token has a setting of&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="bash"&gt;&lt;SPAN class="hljs-string"&gt;"expires_in"&lt;/SPAN&gt;: 3600&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Is that seconds or minutes?&lt;/P&gt;</description>
      <pubDate>Sat, 19 Jun 2021 11:10:50 GMT</pubDate>
      <guid>https://community.viessmann.de/t5/Getting-started-programming-with/Problems-getting-the-access-token/m-p/178578#M86</guid>
      <dc:creator>JueBag</dc:creator>
      <dc:date>2021-06-19T11:10:50Z</dc:date>
    </item>
    <item>
      <title>Betreff: Problems getting the access token</title>
      <link>https://community.viessmann.de/t5/Getting-started-programming-with/Problems-getting-the-access-token/m-p/178632#M87</link>
      <description>&lt;P&gt;I am missing: "grant_type=authorization_code"&lt;/P&gt;</description>
      <pubDate>Sun, 20 Jun 2021 18:34:51 GMT</pubDate>
      <guid>https://community.viessmann.de/t5/Getting-started-programming-with/Problems-getting-the-access-token/m-p/178632#M87</guid>
      <dc:creator>andreas13</dc:creator>
      <dc:date>2021-06-20T18:34:51Z</dc:date>
    </item>
    <item>
      <title>Betreff: Problems getting the access token</title>
      <link>https://community.viessmann.de/t5/Getting-started-programming-with/Problems-getting-the-access-token/m-p/178650#M88</link>
      <description>&lt;P&gt;Thanks for the input, however using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://iam.viessmann.com/idp/v2/token&amp;amp;grant_type=authorization_code&amp;amp;client_id=my_oauth_client&amp;amp;redirect_uri=http://localhost:4200/&amp;amp;code_verifier=my_code_challenge&amp;amp;code=my_received_code" target="_blank"&gt;https://iam.viessmann.com/idp/v2/token?grant_type=authorization_code&amp;amp;client_id=my_oauth_client&amp;amp;redirect_uri=http://localhost:4200/&amp;amp;code_verifier=my_code_challenge&amp;amp;code=my_received_code&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm getting&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;{"error":"invalid-token-request"}&lt;/PRE&gt;&lt;P&gt;as well.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 05:40:04 GMT</pubDate>
      <guid>https://community.viessmann.de/t5/Getting-started-programming-with/Problems-getting-the-access-token/m-p/178650#M88</guid>
      <dc:creator>JueBag</dc:creator>
      <dc:date>2021-06-21T05:40:04Z</dc:date>
    </item>
    <item>
      <title>Betreff: Problems getting the access token</title>
      <link>https://community.viessmann.de/t5/Getting-started-programming-with/Problems-getting-the-access-token/m-p/178656#M89</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.viessmann.de/t5/user/viewprofilepage/user-id/23149"&gt;@JueBag&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;within the second step (Authorization code exchange), have you set the parameter within the header?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&lt;SPAN class="hljs-string"&gt;-H "Content-Type: application/x-www-form-urlencoded"&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also, make sure to send a POST request.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The expiration time of the token is in seconds. However, you can create a refresh token, which helps you obtaining a new access token much easier, as you do not need to do step 1 (Authorization request) anymore. You find the explanation for the refresh token here:&amp;nbsp;&lt;A href="https://developer.viessmann.com/en/doc/authentication" target="_blank"&gt;https://developer.viessmann.com/en/doc/authentication&lt;/A&gt; (Refreshing an access token)&lt;/P&gt;
&lt;P&gt;Hope this helps. If you have further questions, let me know.&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;Michael&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 06:19:03 GMT</pubDate>
      <guid>https://community.viessmann.de/t5/Getting-started-programming-with/Problems-getting-the-access-token/m-p/178656#M89</guid>
      <dc:creator>CustomerCareMichael</dc:creator>
      <dc:date>2021-06-21T06:19:03Z</dc:date>
    </item>
    <item>
      <title>Betreff: Problems getting the access token</title>
      <link>https://community.viessmann.de/t5/Getting-started-programming-with/Problems-getting-the-access-token/m-p/178663#M90</link>
      <description>&lt;P&gt;&lt;a href="https://community.viessmann.de/t5/user/viewprofilepage/user-id/29136"&gt;@CustomerCareMichael&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My trials to send a "POST" request solely with the browser didn't work, using POSTMAN I got my token.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Danke!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Follow-Up Question:&lt;/P&gt;&lt;P&gt;Will the Refresh-Token stay the same over time, or did I get the same on my second request just because it was within a short time?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jun 2021 07:38:29 GMT</pubDate>
      <guid>https://community.viessmann.de/t5/Getting-started-programming-with/Problems-getting-the-access-token/m-p/178663#M90</guid>
      <dc:creator>JueBag</dc:creator>
      <dc:date>2021-06-21T07:38:29Z</dc:date>
    </item>
    <item>
      <title>Betreff: Problems getting the access token</title>
      <link>https://community.viessmann.de/t5/Getting-started-programming-with/Problems-getting-the-access-token/m-p/179357#M91</link>
      <description>Der Beitrag wurde automatisch verschoben.</description>
      <pubDate>Mon, 21 Jun 2021 11:43:22 GMT</pubDate>
      <guid>https://community.viessmann.de/t5/Getting-started-programming-with/Problems-getting-the-access-token/m-p/179357#M91</guid>
      <dc:creator>CustomerCareBen</dc:creator>
      <dc:date>2021-06-21T11:43:22Z</dc:date>
    </item>
    <item>
      <title>Betreff: Problems getting the access token</title>
      <link>https://community.viessmann.de/t5/Getting-started-programming-with/Problems-getting-the-access-token/m-p/191306#M92</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the above link doesnt work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a problem with this line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;curl -X POST "&lt;A href="https://iam.viessmann.com/idp/v2/token" target="_blank"&gt;https://iam.viessmann.com/idp/v2/token&lt;/A&gt;" -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=authorization_code&amp;amp;client_id=xxxxxxxxxxxxxxxxxxx&amp;amp;redirect_uri=&lt;A href="http://192.168.1.199:8123&amp;amp;code_verifier=yyyyyyyyyyyyyyyyyyyyyyyy&amp;amp;code=zzzzzzzzzzzzzzzzzzz" target="_blank"&gt;http://192.168.1.199:8123&amp;amp;code_verifier=yyyyyyyyyyyyyyyyyyyyyyyy&amp;amp;code=zzzzzzzzzzzzzzzzzzz&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the code i've got already. It was not easy because the redirect_uri redirects immediatellay to an other site and i had to be very fast with the screeenshot :)...finally i've got it, but I get with the above curl a response:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{"error":"invalid-token-request"}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;why? what is wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and why it is so complicated: request via url, curl, tokens,&amp;nbsp;client_id,&amp;nbsp;code_verifier,&amp;nbsp;codes, logins? It is an access for my-all-live-savings in a super secure bank? why the client_id is not enough?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Andrzej&lt;/P&gt;</description>
      <pubDate>Mon, 18 Oct 2021 14:55:20 GMT</pubDate>
      <guid>https://community.viessmann.de/t5/Getting-started-programming-with/Problems-getting-the-access-token/m-p/191306#M92</guid>
      <dc:creator>nigolcabej</dc:creator>
      <dc:date>2021-10-18T14:55:20Z</dc:date>
    </item>
    <item>
      <title>Betreff: Problems getting the access token</title>
      <link>https://community.viessmann.de/t5/Getting-started-programming-with/Problems-getting-the-access-token/m-p/191326#M93</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.viessmann.de/t5/user/viewprofilepage/user-id/41883"&gt;@nigolcabej&lt;/a&gt;&amp;nbsp; schrieb:&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;It was not easy because the redirect_uri redirects immediatellay to an other site&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;BR /&gt;You did set that url! Why didn't you use localhost?&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Oct 2021 17:35:03 GMT</pubDate>
      <guid>https://community.viessmann.de/t5/Getting-started-programming-with/Problems-getting-the-access-token/m-p/191326#M93</guid>
      <dc:creator>JueBag</dc:creator>
      <dc:date>2021-10-18T17:35:03Z</dc:date>
    </item>
    <item>
      <title>Betreff: Problems getting the access token</title>
      <link>https://community.viessmann.de/t5/Getting-started-programming-with/Problems-getting-the-access-token/m-p/191350#M94</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;to get the "code" and it have been worked with this url. so it doesnt matter, i suppose, what is the &lt;SPAN&gt;redirect_uri. Why i'm getting the&amp;nbsp;{"error":"invalid-token-request"}?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Oct 2021 19:56:58 GMT</pubDate>
      <guid>https://community.viessmann.de/t5/Getting-started-programming-with/Problems-getting-the-access-token/m-p/191350#M94</guid>
      <dc:creator>nigolcabej</dc:creator>
      <dc:date>2021-10-18T19:56:58Z</dc:date>
    </item>
    <item>
      <title>Betreff: Problems getting the access token</title>
      <link>https://community.viessmann.de/t5/Getting-started-programming-with/Problems-getting-the-access-token/m-p/193919#M108</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a bit puzzled... I also get "invalid-token-request" when trying this on the command line.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my script:&lt;/P&gt;&lt;P&gt;#!/bin/bash&lt;/P&gt;&lt;P&gt;export client_id="client_id"&lt;BR /&gt;export redirect_uri="&lt;A href="http://localhost:4200/oauth-callback" target="_blank"&gt;http://localhost:4200/oauth-callback&lt;/A&gt;"&lt;BR /&gt;export challenge_id=$(cat /proc/sys/kernel/random/uuid)&lt;BR /&gt;export email="email"&lt;BR /&gt;export password="password"&lt;/P&gt;&lt;P&gt;# Authorize and get code for further request&lt;BR /&gt;curl -X POST "&lt;A href="https://iam.viessmann.com/idp/v2/authorize?client_id=$client_id&amp;amp;redirect_uri=$redirect_uri&amp;amp;response_type=code&amp;amp;code_challenge=$challenge_id&amp;amp;scope=IoT%20User" target="_blank"&gt;https://iam.viessmann.com/idp/v2/authorize?client_id=$client_id&amp;amp;redirect_uri=$redirect_uri&amp;amp;response_type=code&amp;amp;code_challenge=$challenge_id&amp;amp;scope=IoT%20User&lt;/A&gt;" \&lt;BR /&gt;-d "hidden-password=00&amp;amp;stayloggedin=Angemeldet bleiben&amp;amp;submit=Login&amp;amp;isiwebuserid=$email&amp;amp;isiwebpasswd=$password" \&lt;BR /&gt;-o login.html&lt;BR /&gt;export code=$(grep $redirect_uri login.html | sed -E 's/(^.*code=)([^"]*)(.*)/\2/g')&lt;/P&gt;&lt;P&gt;# get access token&lt;BR /&gt;curl -H "Content-Type: application/x-www-form-urlencoded" \&lt;BR /&gt;-X POST "&lt;A href="https://iam.viessmann.com/idp/v2/token" target="_blank"&gt;https://iam.viessmann.com/idp/v2/token&lt;/A&gt;" \&lt;BR /&gt;-d "grant_type=authorization_code&amp;amp;code_verifier=$challenge_id&amp;amp;client_id=$client_id&amp;amp;redirect_uri=$redirect_uri&amp;amp;code=$code" \&lt;BR /&gt;-o access_token.json&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am I missing somehting and cannot see it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Nov 2021 10:23:12 GMT</pubDate>
      <guid>https://community.viessmann.de/t5/Getting-started-programming-with/Problems-getting-the-access-token/m-p/193919#M108</guid>
      <dc:creator>MrAnderson</dc:creator>
      <dc:date>2021-11-02T10:23:12Z</dc:date>
    </item>
  </channel>
</rss>

