예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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));
        }
예제 #4
0
            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));
            }