Optimizing User Sign-In and Sign-Out on client side