Problem with SMARTHER v2.0 API
Hi everyone,
I have been using the apis of the smarther Bticino v1.0 successfully for several months using both the refresh token and the access token for authentication.
I’m trying to update my application to use the new version of Smarther’s api (v2.0).
Using the same refresh token and access token of  the previous version (v1.0),
I get the following error message (HTTP/1.1 401 Unauthorized).
Could you help me=
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  4815  100  3688  100  1127   2732    835  0:00:01  0:00:01 –:–:–  2735
Note: Unnecessary use of -X or –request, GET is already inferred.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 –:–:– –:–:– –:–:–     0*   Trying 13.73.164.139…
* TCP_NODELAY set
* Connected to api.developer.legrand.com (13.73.164.139) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
} [5 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.2 (IN), TLS handshake, Server hello (2):
{ [85 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [4990 bytes data]
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [365 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [102 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
{ [1 bytes data]
* TLSv1.2 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: serialNumber=389 290 586 00012; jurisdictionC=FR; businessCategory=Private Organization; C=FR; postalCode=87000; ST=Haute-Vienne; L=LIMOGES; street=128 AVENUE DU MAR▒CHAL LATTRE DE TASSIGNY; O=LEGRAND SNC; OU=0002 389290586; CN=developer.legrand.com
*  start date: Nov  2 00:00:00 2018 GMT
*  expire date: Nov  9 23:59:59 2019 GMT
*  subjectAltName: host “api.developer.legrand.com” matched cert’s “api.developer.legrand.com”
*  issuer: C=GB; ST=Greater Manchester; L=Salford; O=COMODO CA Limited; CN=COMODO RSA Extended Validation Secure Server CA
*  SSL certificate verify ok.
} [5 bytes data]
> GET /smarther/v2.0/chronothermostat/thermoregulation/addressLocation/plants/XXXXX/modules/parameter/id/value/XXXXX/measures HTTP/1.1
> Host: api.developer.legrand.com
> User-Agent: curl/7.52.1
> Accept: */*
> Content-Type: application/json
> Ocp-Apim-Subscription-Key: XXXXX
> Authorization: Bearer XXXXX
{ [5 bytes data]
< HTTP/1.1 401 Unauthorized
< Content-Length: 116
< content-Type: application/json
< Date: Thu, 31 Jan 2019 09:38:17 GMT
<
{ [116 bytes data]
100   116  100   116    0     0    146      0 –:–:– –:–:– –:–:–   146* Curl_http_done: called premature == 0
100   116  100   116    0     0    145      0 –:–:– –:–:– –:–:–   145
* Connection #0 to host api.developer.legrand.com left intact
I think the problem is related to the scope of my application.
{“statusCode”: 401, “message”: “Unauthorized.” Supplied access token is invalid or does not include required scope (s). “}
The error could be caused by the scope of my application? I resubmitted the permissions of my application and are awaiting of approval. I noticed that they were not properly set up.
It may be that the v1.0 of the bees did not take into account permissions (scope)?
Tnx and Regards
Hello Francesco,
Did resubmiting your application resolved your problem ?
If it didn’t work an other solution : maybe you can try to renew your tokens ?
You can follow our tutorial on this link
Tell me if it worked 😉
Have a good day,
Leslie – Community Manager
Hi Leslie,
I am waiting for updates to my application to be approved.
I’ll update you as soon as possible.
Tnx
You must be logged in to reply to this topic.