mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-14 08:17:13 +03:00
CAPI: Re-auth when Access Token expired: Need to .close() first
The old code did this, and without it we enter a loop of: 1. CAPI says unauthorized 2. We call login() 3. But companion.session.state == STATE_OK, so do nothing 4. Re-scheduled CAPI request goes back to 1.
This commit is contained in:
parent
7a52ddd278
commit
919136874d
@ -1160,6 +1160,8 @@ class AppWindow(object):
|
||||
self.status['text'] = _('Frontier CAPI server error')
|
||||
|
||||
except companion.CredentialsRequireRefresh:
|
||||
# We need to 'close' the auth else it'll see STATE_OK and think login() isn't needed
|
||||
companion.session.close()
|
||||
# LANG: Frontier CAPI Access Token expired, trying to get a new one
|
||||
self.status['text'] = _('CAPI: Refreshing access token...')
|
||||
if companion.session.login():
|
||||
|
@ -1210,6 +1210,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
}
|
||||
|
||||
except KeyError:
|
||||
# TODO: Log the exception details too, for some clue about *which* key
|
||||
logger.error(f"LoadoutEquipModule: {entry}")
|
||||
|
||||
elif event_type == 'loadoutremovemodule':
|
||||
|
Loading…
x
Reference in New Issue
Block a user