Browse topics, discover Works With Legrand community!

Home + Control - Get User\'s Plants


I'm just trying to test the API to develop a little web app.

I've subscribed to the Starter Kit and got the 2 keys.

But when  try to get user plants (i have one living now gateway connected) i always receive the follow error:

Request-Context: appId=cid-v1:17d898fc-adbd-487e-96a4-c4287796f34d
Date: Sun, 08 Mar 2020 12:04:00 GMT
Content-Length: 52
Content-Type: application/json
"statusCode": 401,
"message": "JWT not present."

My request is the following (primary key used)

Ocp-Apim-Subscription-Key: ••••••••••••••••••••••••••••••••

Also tried with php client and also tried adding the

'Authorization' => '***********************' (with both the primary and secondary key)

Where I'm wrong?

Please help me!

Thanks in advance


Hi Francesco,

You're missing the "access_token".

You need to have your subscription key ("Ocp-Apim-Subscription-Key") and an access token ("Authorization").

You have to grab the access token using step 2 of this tutorial :

Then, you have to do something like that:

$opts[CURLOPT_HTTPHEADER][]='Ocp-Apim-Subscription-Key: '. $data['Ocp-Apim-Subscription-Key'];
$opts[CURLOPT_HTTPHEADER][]='Authorization: Bearer ' . $data['Authorization'];




Thanks Thierry,

i've tried but can't receive the code from step 1 of the tutorial:


this is the response i get: a blank page with only:

Eliot Authentication Proxy

Can be a matter of redirect_uri? what i have to put on that page?

here is the request:**********************&redirect_uri=

(sure with a valid client_id taken from the email when submitted the app)

and here is the source code of the  response page:


<!DOCTYPE html>

<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<link href="/images/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<title> - Eliot.Authentication.Proxy.Web</title>

<link rel="stylesheet" href="" />
<meta name="x-stylesheet-fallback-test" content="" class="sr-only" />
!function(a,b,c,d){var e,f=document,g=f.getElementsByTagName("SCRIPT"),h=g[g.length-1].previousElementSibling,i=f.defaultView&&f.defaultView.getComputedStyle?f.defaultView.getComputedStyle(h):h.currentStyle;if(i&&i[a]!==b)for(e=0;e<c.length;e++)f.write('<link href="'+c[e]+'" '+d+"/>")}("position","absolute",["\/lib\/bootstrap\/dist\/css\/bootstrap.min.css"], "rel=\u0022stylesheet\u0022 ");
<link rel="stylesheet" href="/css/site.min.css?v=1NjhtDH1GiYovTzHs06vPf5bh2bBctp38DShcW55ZyM" />

<script type="text/javascript">
var appInsights=window.appInsights||function(a){
function b(a){c[a]=function(){var b=arguments;c.queue.push(function(){c[a].apply(c,b)})}}var c={config:a},d=document,e=window;setTimeout(function(){var b=d.createElement("script");b.src=a.url||"",d.getElementsByTagName("script")[0].parentNode.appendChild(b)});try{c.cookie=d.cookie}catch(a){}c.queue=[];for(var f=["Event","Exception","Metric","PageView","Trace","Dependency"];f.length;)b("track"+f.pop());if(b("setAuthenticatedUserContext"),b("clearAuthenticatedUserContext"),b("startTrackEvent"),b("stopTrackEvent"),b("startTrackPage"),b("stopTrackPage"),b("flush"),!a.disableExceptionTracking){f="onerror",b("_"+f);var g=e[f];e[f]=function(a,b,d,e,h){var i=g&&g(a,b,d,e,h);return!0!==i&&c["_"+f](a,b,d,e,h),i}}return c
instrumentationKey: 'b3055cfd-9e5a-4ff8-8670-fe7d81222948'




<div class="container">

<h1>Eliot Authentication Proxy</h1>


<script src="" crossorigin="anonymous"
(window.jQuery||document.write("\u003Cscript src=\u0022\/lib\/jquery\/dist\/jquery.min.js\u0022 crossorigin=\u0022anonymous\u0022 integrity=\u0022sha384-K\u002BctZQ\u002BLL8q6tP7I94W\u002BqzQsfRV2a\u002BAfHIi9k8z8l9ggpc8X\u002BYtst4yBo\/hH\u002B8Fk\u0022\u003E\u003C\/script\u003E"));
<script src="" crossorigin="anonymous"
(window.jQuery && window.jQuery.fn && window.jQuery.fn.modal||document.write("\u003Cscript src=\u0022\/lib\/bootstrap\/dist\/js\/bootstrap.min.js\u0022 crossorigin=\u0022anonymous\u0022 integrity=\u0022sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk\u002B02D9phzyeVkE\u002Bjo0ieGizqPLForn\u0022\u003E\u003C\/script\u003E"));
<script src="/js/site.min.js?v=eHkHX-wpSfK5dHPf2Z62OXaZUKax21jI4-Fu0Tixm9Q"></script>



I think your URL is wrong:you forgot "authorize".

Try that:**********************&redirect_uri=

Also, the "redirect_uri" should point to a callback page.



THANKS A LOT Thierry!!!

Now it works like a charm!

Just one last question about the token:

The access token is valid for one hour right?

So if a deploy an application, will have to take care of refreshing the token before making any request if the previous request was more than one hour before?

Am i right?

I have to implement a mechanics to refresh and safely store my access code server side and the client application (eg browsers or mobile app) ask the code to the server or is better to do it ALL  client side (within mobile app for example)?

Thanks again really!



Yep. According to the tutorial, the access_token is valid only one hour.

So, you have to refresh it regularly using a post request to

I'm planning to implement the refresh functionnality in my program using a cron every 30 minutes. So it should be server side.

To be tested 🙂



I confirm what Thierry said 😉

Thanks a lot for helping the community

Have a good day,

Leslie - Community Manager


I use to retrive at first my plants of my biticino xw8002

I receive an correct HTTP/1.1 200 OK response but plants lists are empty

{"plants":[]}* Connection #0 to host left intact

I thought I was receivings something like:

"plants": [
"id": "some id string",
"name": "casa",
"country": "Europe\Rome"

what's wrong



Hello Michele,

It's normal. You try to call a Smarther2 but the API is not available for now

It's under test on our side, you'll be warned as soon as it's released

Have a good day,

Leslie - Community Manager

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

You must be logged in to reply to this topic.


message8 replies
people4 participants