Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tronity: check fix for empty/none access_token #1142

Merged
merged 5 commits into from
Oct 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/modules/vehicles/tronity/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ def fetch_soc(config: TronityVehicleSocConfiguration, soc_update_data: SocUpdate


def is_token_valid(access_token: str) -> bool:
if not access_token:
if not access_token or access_token == 'None':
MartinRinas marked this conversation as resolved.
Show resolved Hide resolved
log.debug("No token found")
return False
else:
log.debug("Found Token: %s", access_token)

decoded_data = jwt.decode(jwt=access_token, verify=False, algorithms=['HS256'], options={"verify_signature": False})
if datetime.utcfromtimestamp(decoded_data['exp']) < datetime.utcnow():
Expand Down