mirror of
https://github.com/Dielee/volvo2mqtt.git
synced 2026-08-13 19:29:52 +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
|
## v1.12.1
|
||||||
|
|
||||||
### 🐛 Bug Fixes:
|
### 🐛 Bug Fixes:
|
||||||
|
|||||||
+3
-2
@@ -203,11 +203,12 @@ def refresh_auth():
|
|||||||
f = open(token_path)
|
f = open(token_path)
|
||||||
try:
|
try:
|
||||||
data = json.load(f)
|
data = json.load(f)
|
||||||
refresh_token = data["refresh_token"]
|
refresh_data["refresh_token"] = data["refresh_token"]
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise Exception("Cannot refresh token!")
|
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)
|
util.save_to_json(refresh_data, token_path)
|
||||||
session.headers.update({"authorization": "Bearer " + refresh_data["access_token"]})
|
session.headers.update({"authorization": "Bearer " + refresh_data["access_token"]})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user