oklona / Miele-MQTT

A very simple script to read data from Miele@home cloud services, and publish using Mosquitto MQTT
21 stars 10 forks source link

Error Connecting #9

Closed boc-tothefuture closed 3 years ago

boc-tothefuture commented 4 years ago

Everytime I attempt to use the script, I receive the following error.

Oauth authentication did not return array...
Failed to create config! Did you type the correct credentials?

I seem to be able to enable to get it to work using https://oauthdebugger.com/

Are there any suggestions for debugging a failing oauth with this script?

oklona commented 4 years ago

Hi! Sorry I'm late to reply. I was under the impression I was automatically watching the thread, since I "own" the code. Normally that error means your credentials no longer work, and you have to recreate the config file.

Was this with the newest version of the script?

boc-tothefuture commented 4 years ago

This is the newest version of the script. I am getting this error when I am creating the config file. They do work if I manually go through the oauth process.

oklona commented 4 years ago

So, you run Oauth and get a bearer-token, which you then feed into the config file, and then it works?

Interesting. In order to use Miele's Oauth, we perform a post of email-address, password, client ID and country-ID. In a public script, I wouldn't insert anything that would reveal passwords and such, but if write the following to line 173 in the script:

print "Postdata: " . $postdata . PHP_EOL;

You should at least be able to see what data we are trying to send to Miele. My only guess would be if your password contains characters that PHP is not happy with, but as we URL-encode the data, i don't really see what characters that would be.

AleksCee commented 3 years ago

I have a same error on first call. The Page in the Response say, that I have to accept the access. After I do the same Request with the swagger-API from the miele site, I get a Website to login and accept the access. After this, the Script works fine also with the same client_id.

oklona commented 3 years ago

I have a same error on first call. The Page in the Response say, that I have to accept the access. After I do the same Request with the swagger-API from the miele site, I get a Website to login and accept the access. After this, the Script works fine also with the same client_id.

Ok, interesting. Since I have already accepted this for my account, and my ClientID, I don't get that any more. This explains a lot! The best thing would naturally be to be able to present that page, but it is kind of hard to do in a script...

AleksCee commented 3 years ago

Yes, I think so too. It's very hard. Perhaps the manual way is the best option and explain it in the readme? It's only a one-taske-at-all-action - so the overhead for the script is to much, I think.

oklona commented 3 years ago

Yeah, agreed. -But still, the "refresh_token" process of Oauth2 doesn't seem to be implemented with Miele, so we still need to reauthenticate every three months or so...

oklona commented 3 years ago

After asking on a different forum about the refresh_token process, I was told it is in a different section of the documentation to where I was looking for it. -So it is there, it is clearly documented, and can be added. -So, completely my bad. I will start looking into refreshing tokens now.

oklona commented 3 years ago

I hope to be able to look into token refreshing and such next week, in order to create a good Easter release :-)

oklona commented 3 years ago

I have now added support for refreshing the access token. Therefore, I believe this has been resolved. I will close this issue, and I guess it can be reopened if you are still experiencing errors.