private void getSystemCookiesAndTest() { string cookies = Tools.GetCookieStringData("https://naver.com"); if (cookies != null && cookies.Contains("NID_AUT")) { // success - now we add properly, then double check and go! foreach (string s in cookies.Split(new string[] { "; " }, StringSplitOptions.None)) { string[] ss = s.Split('='); addNaverCookieData(ss[0], ss[1]); } Task.Run(() => account.EnsureLoggedIn()).Wait(); account.SaveCookies(); account.LoggedIn = true; } }
private async Task checkAccountLogin() { try { await Account.EnsureLoggedIn(); } catch (NaverAccount.LoginSessionExpiredException) { // session invalid. MessageBox.Show("Your Naver login has expired. A new login is required."); File.Delete(PathToCookies); } }