Forum

Browse topics, discover Works With Legrand community!

Oauth2 Python get code issue

<div class=”post-content”>Hi,I’m tryng to get the “code” according the tutorial.

I’m using a get request I, the request returns 200, but I can’t find the code, I get only webpage.

I try to copy the url in the browser, I click accept on the page that appears, but I still not find the code.

Could you please help me?

Thanks a lot

Davide

</div>

Hello Davide,

When you copy/paste your /authorize request in a web browser, it opens a page asking you to accept consents

Once consent accepted, you are redirected to a blank page. In URL bar, you will find needed code

Example :

https://www.test.com/?code=eyJraWQiOiJjcGltY29yZV8wOTI1MjAxNSIsInZlciI6IjEu…&#8230;..

 

Have a good day,

Leslie – Community Manager

Hi Leslie,

I’m not redirected to a blank page, but I redirected to the page I inserted when I had registered my application and in the url there is not the code.

Davide,

Can you please send me your GET /authorize request + the response you retrieve via the contact form ? (for privacy of your informations)

I’ll then try to see what is going wrong

Have a good day,

Leslie – Community Manager

Hi Leslie,

I find the problem, my application redirect me in another page and delete the code parameter.

I solved.

Thanks a lot

Hi all, if you work with Python you can try using this library: https://github.com/brego81/Legrand-Bticino-Python-API

Once you cloned or download the code, from you terminal you can just do the following

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

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.