philippelt / netatmo-api-python

Netatmo connect API python client (for Netatmo information, see https://dev.netatmo.com)
GNU General Public License v3.0
186 stars 118 forks source link

Error 403 Code 13 #52

Closed cglanz closed 12 months ago

cglanz commented 12 months ago

Thank you for updating, but I get this while trying to use the library:

chris@mars kindleNetatmo % python3 lnetatmo.py
lnetatmo - ERROR: code=403, reason=Forbidden, body=b'{"error":{"code":13,"message":"Application does not have the good scope rights"}}'

Maybe you have a hint for me!

philippelt commented 12 months ago

Well, it is pretty clear, your are attempting to get data out of the scope you defined for your token...

To check which scope is required for your use, read https://dev.netatmo.com/apidocumentation/oauth

Hint: If you just try to read thermostat, this will call HomeData and this last call requires one of read_camera, read_presence or readsmokedetector... But it seems that no others read* will grant you access to HomeData, weird 🤪

cglanz commented 12 months ago

Thanks for your quick response! I really appreciate that! The token I generated is for the scope "read_station" and I just called "python3 lnetatmo.py" to check if everything is ok as mentioned in the docs. Did I do something wrong?

philippelt commented 12 months ago

If you want to run a full test of the library, you will need the read scope that was enabled by default in the previous release because it has to call the get requests even to get a not found answer :
read_station read_camera access_camera read_presence access_presence read_thermostat

I realize that the message could be disturbing despite meaningless, if it is about devices that are not registered: I should definitely modify the test code to disable tests (and notifying it) that are not available with the current token scope...

cglanz commented 12 months ago

Thanks again! After activating all the mentioned scopes for the token it worked! chris@mars kindleNetatmo % python3 lnetatmo.py lnetatmo - WARNING: No home available for testing lnetatmo - WARNING: No thermostat avaible for testing lnetatmo - INFO: OK

I will try to implement it into my application. Thanks a lot!