refactored and ensure all config is present before redirecting to "login" page