Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toon new API authentication #25

Closed
stephanvdplas opened this issue Nov 22, 2019 · 14 comments
Closed

Toon new API authentication #25

stephanvdplas opened this issue Nov 22, 2019 · 14 comments

Comments

@stephanvdplas
Copy link

Toon will use new authentication starting 12/1/2019. See https://developer.toon.eu/authentication for more info.

From December 2019 onwards, Eneco users are required to use the “mijn Eneco” login to access their Toon, use the following call from the application to use the “mijn Eneco” as identity source:

curl -v -k
https://api.toon.eu/authorize?response_type=code
&redirect_uri=<redirect_url>
&client_id=<consumer_key>
&issuer=identity.toon.eu
&tenant_id=eneco
From the ToonAPI website's login page, the end user needs to provide his credentials. A redirect will then be performed to the redirect_uri provided before with a code. The application can now use that code and the application key pair to get an access token that looks like this:

curl -k -X POST
-H "Content-Type: application/x-www-form-urlencoded"
-d "client_id=<consumer_key>
&client_secret=<consumer_secret>
&grant_type=authorization_code
&redirect_uri=<redirect_uri>
&tenant_id=eneco
&code="
https://api.toon.eu/token

Again, in this call, when users have logged in via "Mijn Eneco", add the issuer to this request:

curl -k -X POST
-H "Content-Type: application/x-www-form-urlencoded"
-d "client_id=<consumer_key>
&client_secret=<consumer_secret>
&grant_type=authorization_code
&issuer=identity.toon.eu
&redirect_uri=<redirect_uri>
&tenant_id=eneco
&code="
https://api.toon.eu/token

@stephanvdplas
Copy link
Author

Is the ToonAPIlib4Domoticz compatible with this new authentication method?

@stephanvdplas
Copy link
Author

A 10-year-valid access token can now be generated via "https://api.toon.eu/toonapi-accesstoken?tenant_id=eneco&client_id=<consumer_key>". I think this key has to be entered somewhere in the ToonApi to connect to the Eneco site.

@tne7laa
Copy link
Contributor

tne7laa commented Nov 22, 2019

I have followed the instruction in my email and managed to get an "Access token" as stated. But I don't have a clue what to do with it.
Hope someone does understand what they want us to do and explain here for us.

@rene2716
Copy link

Any news on this?

@darkrain-nl
Copy link
Contributor

Version 4 of the library from Costas now has support for this, but that don't work with this plugin for now. Let me check what I can do to make it work.
@JohnvandeVrugt perhaps this is to complicated for my Python skills but I'll try anyway ;)

@rene2716
Copy link

rene2716 commented Nov 30, 2019 via email

@darkrain-nl
Copy link
Contributor

I already have it working with the new V4 library, will do a PR soon

@rene2716
Copy link

rene2716 commented Nov 30, 2019 via email

@darkrain-nl
Copy link
Contributor

#26 makes this work.

The changes are not really hard to do, just run "sudo pip3 install toonapilib -U" and edit "plugin.py" with what I did in the PR.

@tne7laa
Copy link
Contributor

tne7laa commented Nov 30, 2019

Great work!.
Does anyone also use the homebridge plugin?
I'm using it for controlling Toon via Apple HomeKit and needs also changes I think.

@rene2716
Copy link

rene2716 commented Nov 30, 2019 via email

@darkrain-nl
Copy link
Contributor

Then you did not provide an Access Token, sorry I did not tell you to create this first.
Please go to "https://api.toon.eu/toonapi-accesstoken?tenant_id=eneco&client_id=<consumer_key>" where the consumer key is the value you can find on https://developer.toon.eu or more specific https://developer.toon.eu/user/me/apps

Sorry for not being complete..

@rene2716
Copy link

rene2716 commented Nov 30, 2019 via email

@JohnvandeVrugt
Copy link
Owner

Thanks Jan, for doing a good job.
I didn't had the time to check out the new API / toonapilib requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants