AdyRock / com.lightwaverf.smartseries

Homey app for Lighwave Smart Series devices
https://adyrock.github.io/com.lightwaverf.smartseries/
GNU General Public License v3.0
2 stars 2 forks source link

Loss of token #6

Closed Cassiobury-Drive closed 2 years ago

Cassiobury-Drive commented 4 years ago

Thanks for creating this for Homey. I have an issue which is probably not your app but just wondering if you know how to solve it.

Every few days the connection to the hub stops working and I have to refresh the Bearer Token and Refresh Token.

Is there any way of fixing these completely or for a longer period?

Thanks

Terry

AdyRock commented 4 years ago

My Homey has been logged in for well over year now with no interruption, except a couple of LW server outages, but it automatically recovers from that when they came back up..

Do you have anything else connecting to the hub like HA or Domoticz, etc?

When the app logs in it uses the bearer token to identify the user account and the refresh token to obtain an access token + a new refresh token. The access token is used during each server request to authenticate but is only valid for a short period of time (I can't remember how long). When it has expired the access is refused so the app has to fetch a new access token using the bearer token and the refresh token it obtained last time. And then the cycle repeats. If something else connects using a the bearer token and a new refresh token (obtained from the LW app / web site), the refresh token that was retrieved is no longer valid. Therefore a new access token can't be obtained until you manually enter a new refresh token.

Cassiobury-Drive commented 4 years ago

Hi Adrian,

Thanks for the quick response. Now you mention it I have an old version of HA sitting on a Raspberry PI so that may be what is causing the problem. I will make sure this is shut down and see what happens.

Cheers

Terry From: Adrian Rockall notifications@github.com Sent: 20 August 2020 17:38 To: AdyRock/com.lightwaverf.smartseries com.lightwaverf.smartseries@noreply.github.com Cc: Terry WD173AA@outlook.com; Author author@noreply.github.com Subject: Re: [AdyRock/com.lightwaverf.smartseries] Loss of token (#6)

My Homey has been logged in for well over year now with no interruption, except a couple of LW server outages, but it automatically recovers from that when they came back up..

Do you have anything else connecting to the hub like HA or Domoticz, etc?

When the app logs in it uses the bearer token to identify the user account and the refresh token to obtain an access token + a new refresh token. The access token is used during each server request to authenticate but is only valid for a short period of time (I can't remember how long). When it has expired the access is refused so the app has to fetch a new access token using the bearer token and the refresh token it obtained last time. And then the cycle repeats. If something else connects using a the bearer token and a new refresh token (obtained from the LW app / web site), the refresh token that was retrieved is no longer valid. Therefore a new access token can't be obtained until you manually enter a new refresh token.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/AdyRock/com.lightwaverf.smartseries/issues/6#issuecomment-677773212, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AO5JPUKR2JL6DSMUM7UEFK3SBVGM7ANCNFSM4QGFR4SQ.