wp_set_auth_cookie( $user_id, $remember, $secure )
This function sets the cookie.
This function will delete the cookie from the client browser. This happens when the user clicks on the Logout link in the Administration interface.
This function also utilizes the cookies. Checks whether the cookie is present on the client browser. If it is not, the user is sent to the wp-login.php login screen. After logging in, the user is sent back to the page he or she attempted to access.