BoschSmartHome / bosch-shc-api-docs

Bosch Smart Home Controller Local REST API
Other
208 stars 44 forks source link

Cannot register new client #24

Closed cmkreuter closed 4 years ago

cmkreuter commented 4 years ago

I have a certificate per your documentation and base64 encoded the password that I just set, but when I send the request (after pressing the button on the controller) I get

POST /smarthome/clients HTTP/1.1 Host: bosch-smart-home-controller.fritz.box:8443 User-Agent: insomnia/7.1.1 Content-Type: application/json Systempassword: XXXXXXXXXXXX Accept: / Content-Length: 1424

| { | "@type": "client", | "id": "oss_test", | "name": "OSS test", | "primaryRole": "ROLE_RESTRICTED_CLIENT", | "certificate": "-----BEGIN CERTIFICATE-----\rxxxxxxx\r-----END CERTIFICATE-----" | }

< HTTP/1.1 401 Unauthorized < x-mbs-platform-state: 100 < date: Tue, 10 Mar 2020 19:03:57 GMT < content-length: 0 < Cache-Control: no-cache, no-store, must-revalidate < connection: close

This is a log from Insomnia, but Postman has the same result. Any ideas what is missing?

philbuettner commented 4 years ago

Hi cmkreuter,

you get a 401 Unauthorized as a response. This is probably due to the fact that the password was incorrectly encoded. Please check you encoding method. In the documentation there is an example given. Check if your encoding method has the same output as a result as the example.

Kind regards, Phil

cmkreuter commented 4 years ago

Thank you, yes it was incorrectly encoded. I used the command line tool base64 on Mac and for your example it returns bXlfcGFzc3cwcmQK instead of bXlfcGFzc3cwcmQ= Interestingly with https://www.base64decode.org/ both variants decode to the correct string...