'Store authentication token to session and persistent storage.'

def store_auth_token(self, token):

    self.auth_tokens[self.mx_id] = token
    try:
        with open(self.session_filepath, 'w') as handle:
            handle.write(json.dumps(self.auth_tokens))
    except (OSError, IOError, PermissionError) as ex:
        _LOGGER.warning("Storing    authentication    tokens    to    file    '%s'    failed:    %s", self.session_filepath, str(ex))
