Forum

Browse topics, discover Works With Legrand community!

problem testing the API

I’m trying to use the Starter Kit and test some of the APIs, but am getting an unauthorized response

I have setup subscription on my account and am following the steps in your FAQ (https://developer.legrand.com/faq/), but cant get it to work – the HTTP request is pulling in the correct subscription key, but it seems the OAuth2 authorization process hasnt worked

Any thoughts what I am doing wrong

 
<p style=”box-sizing: inherit; margin: 0px 0px 1rem; padding: 0px; line-height: 1.6; text-rendering: optimizelegibility; color: #575757; caret-color: #575757; font-family: ‘Segoe UI’, ‘Noto Sans’, sans-serif; text-size-adjust: auto;”><strong style=”box-sizing: inherit; line-height: inherit;”>To find the plantId<span class=”Apple-converted-space”> </span></p>

<ul style=”box-sizing: inherit; margin: 0px 0px 1rem 1.25rem; padding: 0px; list-style-position: outside; line-height: 1.6; caret-color: #575757; color: #575757; font-family: ‘Segoe UI’, ‘Noto Sans’, sans-serif; text-size-adjust: auto;”>
<li style=”box-sizing: inherit; margin: 0px; padding: 0px; font-size: inherit;”>Sign up with your Works with Legrand account. You must have<span class=”Apple-converted-space”> </span>subscribed to the Starter Kit
<li style=”box-sizing: inherit; margin: 0px; padding: 0px; font-size: inherit;”>Go on the “API” drop down menu, click on “APIS LIST” and choose the Smarther API or Home + Control API
<li style=”box-sizing: inherit; margin: 0px; padding: 0px; font-size: inherit;”>On the left, click on “GET Plants” for the Smarther or “GET Get users’ plants” for Home + Control. Then go in the “Try it”
<li style=”box-sizing: inherit; margin: 0px; padding: 0px; font-size: inherit;”>In Authorization section, choose “Authorization code” for<span class=”Apple-converted-space”> </span><strong style=”box-sizing: inherit; line-height: inherit;”>ELIOT – Azure AD B2C – OpenID Connect<span class=”Apple-converted-space”> </span>for the Smarther or<span class=”Apple-converted-space”> </span><strong style=”box-sizing: inherit; line-height: inherit;”>OAuth Server for Try it Eliot API<span class=”Apple-converted-space”> </span>for Home + Control. If you are logged in, other information are already filled up
<li style=”box-sizing: inherit; margin: 0px; padding: 0px; font-size: inherit;”>A popup will be opened. Fill the information and validate
<li style=”box-sizing: inherit; margin: 0px; padding: 0px; font-size: inherit;”>Click on “Send” button and retrieve the ID of the plant in the Response content

<p style=”box-sizing: inherit; margin: 0px 0px 1rem; padding: 0px; line-height: 1.6; text-rendering: optimizelegibility; color: #575757; caret-color: #575757; font-family: ‘Segoe UI’, ‘Noto Sans’, sans-serif; text-size-adjust: auto;”></p>

Hello,

I suppose you are talking about the /authorize request. It must look like the following :

https://partners-login.eliotbylegrand.com/authorize?response_type=code&redirect_uri=https://YourRedirectURI.com&client_id=7366XXX-XXXX-XXXXX-XXXXXX

Then, copy/paste your request in a web browser. You will be asked authenticate with a end-user account, to accept scopes and you will be redirected to a blank page

Once scopes accepted, you will retrieve in URL bar the “code” value needed for /token request

If it still doesn’t fix your issue, please send me via the contact form the exact request you send and the JSOn you retrieve

Have a good day,

Leslie – Community Manager

Hi Leslie

Maybe I’ve misunderstood

I thought you could try out the API direct from the website

eg

https://portal.developer.legrand.com/docs/services/59e9ad7f8bda9e0b3caea28c/operations/getusersplants

and clicking the Try It button

This brings up a loginbyeliot popup for OAuth

– I assumed you enter the developer account details (which worked) , but I get the Invalid Token error

 

If I try a user account (with real devices) I get an account not found during the OAuth stage

Images:
You must be logged in to view attached files.

It seems we have an issue on Try It function following a deployment yesterday (I have the same issue)

I warned the teams about it and I’ll keep you informed once fixed. If you try calls via Postman for example : it works

Have a good day,

Leslie – Community Manager

Good news : the Try It function is now fixed. You can test with your end-user account

Have a good day,

Leslie – Community Manager

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

You must be logged in to reply to this topic.