EDITING: Change 403 error handling to 401 for login