Feature/implement event when token has been refreshed or changed - #17
Conversation
|
@KoenZomers, heb je misschien tijd om dit te reviewen? ;-) |
|
@NMauel Thanks for your efforts again here. Can you elaborate a bit more on the situation you're trying to fix here? I'm also using it in an unattended Docker container and do not recognize the issue of the token timing out so keen on learning more on where our scenarios deviate. |
|
Are you able to shutdown the container for 10 minutes or more when it has been running for at least 10 minutes? When the token is refreshed (after 10 minutes), the refresh token is also renewed. When you try to use the old token after a reboot (after more than 10 minutes) the refresh token is invalid. You need to re-register again (using the URL). Now, when the token is refreshed (including the refresh token) I get an event from the lib which provides me the new token. I serialize it to Json and save it on disk (mounted volume). This way I can deserialize it on a reboot and use the refresh token to get me a new token (within 30 days) without re-registering my device again using the URL. |
Because it actually is :-)
450f88f to
50396d8
Compare
|
Rebased on latest master... |
|
@KoenZomers, I solved it by managing the token myself and re-authenticate at the library each time i have renewed the token. Closing PR. |
When token is changed/refreshed, you will be notified by the TokenChangedEvent...
Such way you can store the token locally so you don't need to re-register @ Tado on a restart (within the 30 days the refresh token is still valid).
Using this in a dockerized application on a RPi with auto-(re)start... ;-)