private async void LoginButton_Click(object sender, EventArgs e) { if (accessToken.Length == 0) { MessageBox.Show("Please get a key first", "Login"); } else { if (twitchUser == null) { try { twitchUser = await twitchClient.RetrieveUserWithAccessToken(accessToken); Status.Text = "Logged In!"; Status.ForeColor = System.Drawing.Color.Green; timer1.Enabled = true; timer2.Enabled = true; Start(); } catch { MessageBox.Show("Login failed!", "Login"); } } else { MessageBox.Show("Already logged in!", "Login"); } } }
public async void RetrieveUserWithAccessToken() { User twixelTest = await twixel.RetrieveUserWithAccessToken(accessToken); Assert.True(twixelTest.authorizedScopes.Contains(TwitchConstants.Scope.UserRead)); }