public void New(object parameter, string accountStoreKeyName, string clientId, string scope, Uri authorizeUrl, string loginRelativeUri, string tokenRelativeUri, Uri redirectUrl)
        {
            if (auth != null)
            {
                auth.Completed -= OAuth2Authenticator_Completed;
                auth.Error     -= OAuth2Authenticator_Error;
            }

            this.accountStoreKeyName = accountStoreKeyName;

            LoadAccount();

            auth = new PkceExplicitFlowAuthenticator(clientId, scope, authorizeUrl, loginRelativeUri, tokenRelativeUri, redirectUrl);

            auth.Completed += OAuth2Authenticator_Completed;
            auth.Error     += OAuth2Authenticator_Error;
        }
        public void New(object parameter, string accountStoreKeyName, string clientId, string scope, Uri authorizeUrl, Uri redirectUrl)
        {
            if (auth != null)
            {
                auth.Completed -= OAuth2Authenticator_Completed;
                auth.Error     -= OAuth2Authenticator_Error;
            }

            this.accountStoreKeyName = accountStoreKeyName;

            LoadAccount();

            auth = new CustomOAuth2Authenticator(
                clientId: clientId,
                scope: scope,
                authorizeUrl: authorizeUrl,
                redirectUrl: redirectUrl);

            auth.Completed += OAuth2Authenticator_Completed;
            auth.Error     += OAuth2Authenticator_Error;
        }
        public OAuthLogonWebView(OAuth2AuthenticatorBase platformOAuthClient)
        {
            this.platformOAuthClient = platformOAuthClient;
            this.platformOAuthClient.TokenAccessReceived -= OnTokenAccessReceived;
            this.platformOAuthClient.TokenAccessReceived += OnTokenAccessReceived;

            InitializeComponent();

            this.Loaded += (object sender, RoutedEventArgs e) =>
            {
                //Add the message hook in the code behind since I got a weird bug when trying to do it in the XAML
                //webBrowser.MessageHook += WebBrowser_MessageHook;

                //Delete the cookies since the last authentication
                //DeleteCookies();

                //Create the destination URL
                var getUriTask = platformOAuthClient.GetInitialUrlAsync();
                getUriTask.Wait();

                var destinationURL = getUriTask.Result;
                webBrowser.Navigate(destinationURL);
            };
        }