Added a fetch-and-logout utility method.