public static void ShowOAuthView(OAuth2WebServerFlow oAuth) { currentPage = Application.Current.MainPage; var oAuthView = new FlexibleWebAuthView(); oAuth.InvokeUserAuthorization(oAuthView); Application.Current.MainPage = oAuthView; oAuthView.Navigate(oAuthView.AuthorizeUrl); oAuthView.OAuthSuccess += async(sender, args) => { await oAuth.ProcessAuthorizationAsync(sender as Uri); await Application.Current.MainPage.DisplayAlert("Access Token", oAuth.AccessToken.Code, "OK", "Cancel"); RestoreView(); OnAuthenticated?.Invoke(oAuth, new AuthenticatedEventArgs(oAuth.AccessToken.Code, oAuth.AccessToken.RefreshToken, oAuth.AccessToken.Expires)); }; }
public static void ShowOAuthView(OAuth2WebServerFlow oAuth) { StoreElements(); var webAuthView = new FlexibleWebAuthView { Height = Window.Current.Bounds.Height }; oAuth.InvokeUserAuthorization(webAuthView); var elements = GetUIElementCollectionInstance(); elements.Clear(); elements.Add(webAuthView); webAuthView.Navigate(webAuthView.AuthorizeUrl); webAuthView.OAuthSuccess += async(sender, args) => { await oAuth.ProcessUserAuthorizationAsync(sender as Uri); RestoreView(); OnAuthenticated?.Invoke(oAuth, new AuthenticatedEventArgs(oAuth.AccessToken.Code, oAuth.AccessToken.RefreshToken, oAuth.AccessToken.Expires)); await new MessageDialog("Access Token Received: " + oAuth.AccessToken.Code).ShowAsync(); }; }