mirror of
https://github.com/Dielee/volvo2mqtt.git
synced 2026-07-22 02:13:01 +02:00
Add more logging for refresh process // renew refresh token if returned from api
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
## v1.12.2
|
||||
|
||||
### 🚀 Features:
|
||||
|
||||
- Add more logging for refresh process
|
||||
- Update refresh token, if volvo API returns a new one
|
||||
|
||||
## v1.12.1
|
||||
|
||||
### 🐛 Bug Fixes:
|
||||
|
||||
+3
-2
@@ -203,11 +203,12 @@ def refresh_auth():
|
||||
f = open(token_path)
|
||||
try:
|
||||
data = json.load(f)
|
||||
refresh_token = data["refresh_token"]
|
||||
refresh_data["refresh_token"] = data["refresh_token"]
|
||||
except ValueError:
|
||||
raise Exception("Cannot refresh token!")
|
||||
else:
|
||||
logging.info("New refresh token found, updating!")
|
||||
|
||||
refresh_data["refresh_token"] = refresh_token
|
||||
util.save_to_json(refresh_data, token_path)
|
||||
session.headers.update({"authorization": "Bearer " + refresh_data["access_token"]})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user