Forum

Browse topics, discover Works With Legrand community!

Again on Oauth2: python

Hello,

I am struggling in getting the oauth2 working on python. I created an Application on Legrand, so I have the ID and Secrets. Because App, I do not have a redirection uri.

According to the tutorial, using a get request I can complete the Step1. The request returns "OK 200", but I cannot find the Code. From I can see it seems that the request return contains a sort of webpage (or the code of an HTML page); what does it means? I mean after the completition of the request I was supposing to have the code, according to your tutorial.

Please give me some more directions. Thank you very much for your support.

Lorenzo

Hello Florent,

Parameters of your request must be set in the Body

If it can help, here is a Postman generated cURL /token request :

curl -L -X POST 'https://partners-login.eliotbylegrand.com/token' \
-F 'client_id=7366fd4e-b078-XXXXXXX' \
-F 'grant_type=authorization_code' \
-F 'client_secret=GB-(vXXXXXXX' \
-F 'code=eyJraWQiOiJjcGltY29yZV8wOT...'

Have a good day,

Leslie - Community Manager

Happy to read you resolved it 😉

I let my message here in the case it could help

Have a good day,

Leslie - Community Manager

Thank you very much, this is exactly what I did. I now have access to all the controls in my house from the commandline, which I find cool !

Authentication seems to be the tricky part, then it's painless.

Regards,

FdL

Hi,

Here are the scripts I'm currently using on my phone, they might be of some help to others ...

https://github.com/fdlamotte/LightControl

Regards,

FdL

Hi all, if you are  using Python please have at https://github.com/brego81/Legrand-Bticino-Python-API

It is quite easy,  from you terminal you can just do the following an the authentication process is automated

cd Legrand-Bticino-Python-API
python -m pip install pprintpp pyyaml
python example.py

Hi Matt, thanx for your pointer. I'll check it out!

Viewing 6 posts - 31 through 36 (of 36 total)

You must be logged in to reply to this topic.

Information

message35 replies
people5 participants