eclipse-archived / smarthome

Eclipse SmartHome™ project
https://www.eclipse.org/smarthome/
Eclipse Public License 2.0
862 stars 783 forks source link

[OAuth2] Fix storing empty refresh token on refreshToken call. #6637

Closed Hilbrand closed 5 years ago

Hilbrand commented 5 years ago

When a call is made for a new access token it might not return the refresh token in the data. This was the case with Spotify Api, only to find it out after 2 hours running. Because the first save is from the authorization and that contains the refresh token. The first call to refresh the access token (after 1 hour, expire time is 3600 sec.) sets the refresh token to null. And then after access token expires again (2nd hour) it gives the exception no refresh token available.

Some minor changes: Moved creating OAuthConnector after checks which throw exceptions.

Signed-off-by: Hilbrand Bouwkamp hilbrand@h72.nl