Example #1
0
        private async void LoginButton_Click(object sender, EventArgs e)
        {
            UserTokenManager manager = new UserTokenManager();

            bool success = await manager.LoginAsync();

            if (success)
            {
                _client = GrooveClientFactory.CreateGrooveClient(Secret.CLIENTID, Secret.CLIENTSECRET, manager);
                EnableButtons();
            }
            else
            {
                // show error that login had a failure
                OutputTextBox.Text = "Login failure";
            }
        }
        private async void LoginButton_Click(object sender, EventArgs e)
        {
            UserTokenManager manager = new UserTokenManager();

            try
            {
                bool loginSuccess = await manager.LoginAsync();

                if (loginSuccess)
                {
                    _client = GrooveClientFactory.CreateGrooveClient(Secret.CLIENTID, Secret.CLIENTSECRET, manager);
                    WriteOutputLine("Successfully logged in.");
                    OnLoginSuccess();
                }
                else
                {
                    WriteOutputLine("Error while logging in");
                }
            }
            catch (ConfigurationErrorsException ex)
            {
                WriteOutputLine("Could not save refresh token. Please run as admin to allow saving of refresh token, or you will have to manually authenticate with every request.");
            }
        }