private static string GetAuthCode(string account, Uri authenticationUri, Uri redirectUri) { string oauth_token = null; if (logOn == null) { logOn = new BrowserLogOn(AsyncOperationManager.SynchronizationContext); } EventHandler <AuthenticatedEventArgs> callback = (s, e) => oauth_token = e.Parameters[Parameters.Code]; logOn.Authenticated += callback; logOn.Show("hubiC", account, authenticationUri, redirectUri); logOn.Authenticated -= callback; return(oauth_token); }
private static string GetAuthCode(string account, Uri authenticationUri, Uri redirectUri) { string authCode = null; if (logOn == null) { logOn = new BrowserLogOn(AsyncOperationManager.SynchronizationContext); } EventHandler <AuthenticatedEventArgs> callback = (s, e) => authCode = e.Parameters[Parameters.Code]?.TrimStart('M'); logOn.Authenticated += callback; logOn.Show("OneDrive-Legacy", account, authenticationUri, redirectUri); logOn.Authenticated -= callback; return(authCode); }
private static Tuple <string, string> GetAuthCode(string account, Uri authenticationUri, Uri redirectUri) { string oauth_token = null, oauth_verifier = null; if (logOn == null) { logOn = new BrowserLogOn(AsyncOperationManager.SynchronizationContext); } EventHandler <AuthenticatedEventArgs> callback = (s, e) => { oauth_token = e.Parameters["oauth_token"]; oauth_verifier = e.Parameters["oauth_verifier"]; }; logOn.Authenticated += callback; logOn.Show("Copy", account, authenticationUri, redirectUri); logOn.Authenticated -= callback; return(new Tuple <string, string>(oauth_token, oauth_verifier)); }
public Task <IDictionary <string, string> > AuthenticateAsync(Uri requestUri, Uri callbackUri) { var result = new Dictionary <string, string>(); if (logOn == null) { logOn = new BrowserLogOn(AsyncOperationManager.SynchronizationContext); } EventHandler <AuthenticatedEventArgs> callback = (s, e) => { for (int i = 0; i < e.Parameters.Count; ++i) { result.Add(e.Parameters.Keys[i], e.Parameters[i]); } }; logOn.Authenticated += callback; logOn.Show("OneDrive", account, requestUri, callbackUri); logOn.Authenticated -= callback; return(Task.FromResult <IDictionary <string, string> >(result)); }