private void GetAccessToken() { var login = new LiveLogin ( "000000004C1337C9", "7N3IwTyTGoGGimndiJAQiG2GBspOLyFZ", "http://oauthproxy.nemiro.net/", // scope: https://dev.onedrive.com/auth/msa_oauth.htm#authentication-scopes "onedrive.readwrite", //,onedrive.appfolder loadUserInfo: true ); login.Owner = this; login.ShowDialog(); if (login.IsSuccessfully) { Properties.Settings.Default.AccessToken = login.AccessToken.Value; Properties.Settings.Default.Save(); this.Text = String.Format("{0} (OneDrive)", login.UserInfo.DisplayName ?? login.UserInfo.UserName); this.GetFiles(); } else { MessageBox.Show("error..."); } }
public void GetLoginCookie(string target, string user, string pwd, string outputPath) { var gate1 = new O365Login(_driver, user); var gate2 = new LiveLogin(_driver, pwd); _driver.Navigate().GoToUrl(target); gate1.Login(); gate2.Login(); _driver.WaitForElementToBeVisible(By.LinkText("Documents")); _driver.Title.Should().Contain("Documents"); var listItem = _driver.FindElement(By.XPath("//a[contains(@href,'D64MB')]")); listItem.Text.Should().Contain("D64MB"); var cookie1 = Browser.ReadCookie(_driver, "FedAuth"); var cookie2 = Browser.ReadCookie(_driver, "rtFa"); System.IO.File.WriteAllText(outputPath, $"{cookie1};{cookie2}"); }