public string AskForRegistrationUrl(UserProfileInfo user, string redirectUrl, out int tempCredentialId) { LiveAuthClient auth = new LiveAuthClient(clientId, clientSecret, redirectUrl); string url = auth.GetLoginUrl(scopes); tempCredentialId = -1; return url; }
public async void DoLogin(string clientId) { var scopes = new List<string>(); scopes.Add("wl.calendars"); scopes.Add("http://outlook.office.com/Calendars.ReadWrite"); var sdk = new LiveAuthClient(clientId); var result = await sdk.InitializeAsync(scopes); var url = sdk.GetLoginUrl(scopes); var token = sdk.Session.AuthenticationToken; }
// TODO: REMOVE Login() / Logout() / OnLiveAuthCompleted() / etc. from this library, as they should not take a dependency // specifically on the Desktop Live ID library public void Login() { if (_loginWindow != null) { _loginWindow.Close(); } var liveAuthClient = new LiveAuthClient("000000004811DB42"); string startUrl = liveAuthClient.GetLoginUrl(new List<string>() { "service::prodkds.dns-cargo.com::MBI_SSL" }); _loginWindow = new LiveAuthWindow( startUrl, this.OnLiveAuthCompleted, "Login to the Microsoft Account associated with your Band" ); _loginWindow.Login(); }
public static async Task<Microsoft.OneDrive.OneDriveClient> GetOneDriveClientAsync(string clientId, OneDriveScopes[] scopes, IRefreshTokenHandler refreshTokenHandler = null) { LiveAuthClient authClient = new LiveAuthClient(clientId, refreshTokenHandler); var authScopes = from s in scopes select OAuthScopeAttribute.OAuthScopeForEnumValue(s); LiveLoginResult loginResult = await authClient.IntializeAsync(authScopes); if (loginResult.Status == LiveConnectSessionStatus.Connected) { return new OneDriveClient(new LiveConnectClient(loginResult.Session)); } string startUrl = authClient.GetLoginUrl(authScopes); string endUrl = OAuthDesktopEndPoint; FormMicrosoftAccountAuth authForm = new FormMicrosoftAccountAuth(startUrl, endUrl); DialogResult result = await authForm.ShowDialogAsync(); if (DialogResult.OK == result) { return await OnAuthComplete(authClient, authForm.AuthResult); } return null; }