finish log in and log out using secure cache