Apollon77 / daikin-controller-cloud

Connect and Control Daikin Cloud devices
MIT License
96 stars 26 forks source link

Update refresh token #116

Closed ptz0n closed 10 months ago

ptz0n commented 10 months ago

What's the problem?

Refresh token is never updated when refreshing the tokens.

HTTPError: Response code 400 (Bad Request)

{
  "__type": "NotAuthorizedException",
  "message": "Refresh Token has expired"
}

What's changed?

Update and emit the updated tokens including refresh token when received in refresh response. Looks like this was a typo as L205===L207.

How can this be verified?

Following spec: https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AuthenticationResultType.html#CognitoUserPools-Type-AuthenticationResultType-RefreshToken

Apollon77 commented 10 months ago

ohh you are right ... a classical "typo" :-)

Thank you!

Apollon77 commented 10 months ago

PS: I think the reason is also that Refresh-token (at least in the past) never was updated at all ... so was always the same returned. but se we are sure to make best out of it. will be released in some mins

Apollon77 commented 10 months ago

@ptz0n Did you really tested this. i think it roduces issues because on refresh NEVER a refresh token is returned! So most likely we make it more bad with this change and override the refresh token with "nothing" ... uers test that right now. This means that one refresh works and secodn refresh fails then ...

I assume the "refresh expired" was fixed by my one other change before

ptz0n commented 10 months ago

Yes, I’m running this patch and haven’t run into any issues yet. Maybe check for existance before replacing would be a good addition?

Apollon77 commented 10 months ago

Yes most likely. It all my tests show that there never is a refresh token returned.

Apollon77 commented 9 months ago

Adjusted in new release