Factor out isOpenPrefix
Factor out authenticateWithBackend