Refresh token not working properly

The Netatmo API is a set of webservices allowing developers and third parties to access Netatmo device's data.
Post Reply
Bappidi
Posts: 3
Joined: 26 Mar 2023, 19:54

Refresh token not working properly

Post by Bappidi »

Hi,

I created a Node.js app that I use to toggle the monitoring of my Presence cameras. I implemented the auth-flow and everything works fine (authorizing, retrieving tokens, using refresh token). To be more failsafe, I store my access and refresh token and the expire time in the file system so they are persisted even if I restart my service and I do not need to authorize again using the browser.
But this does not seem to work. When restarting the app and using the stored tokens (generated like a minute earlier) I am able to retrieve /homesdata and it displays my cameras correctly. However, if I want to use /setstate to toggle the monitoring I receive "{ code: 21, message: 'Invalid device_id, 70:ee:50:XX:XX:XX' }" - the ID that should be correct and that is correctly listed in /homesdata. When I use the browser to authorize again it works. But from my understanding the existing and still valid token should work even if the app has been restarted.

Any help appreciated as having to manually authorize again when I do code changes and thus need to restart the app is quite annoying and a potential error source during productive usage.
Post Reply

Return to “Netatmo API”