i am trying to learn tweetinvi
credential, so i have the following UI
and these 2 method, initAuthentication
and startAuthentication
private void initAuthentication()
{
var appCredentials = new TwitterCredentials(consumerKey, consumerSecret);
var authenticationContext = AuthFlow.InitAuthentication(appCredentials);
Process.Start(authenticationContext.AuthorizationURL);
//i am commenting the following code
//var userCredentials = AuthFlow.CreateCredentialsFromVerifierCode(textBox1.Text, authenticationContext);
//Auth.SetCredentials(userCredentials);
//so the user have some time to copy the pinCode
//paste them into available textbox
// and continue executing startAuthentication() by clicking authenticate button.
}
private void startAuthentication (string pinCode)
{
//if we split like this, the authenticationContext is error, because it doesn't exist in current context
var userCredentials = AuthFlow.CreateCredentialsFromVerifierCode(pinCode, authenticationContext);
Auth.SetCredentials(userCredentials);
}
if we join both part in one function, there's no time for user to copy paste the pin code into textbox.
however, if we split both part to different function, there's some time for user to copy paste the pin code into textbox, but it seems authenticationContext
got error because it doesn't exist in current context
is there any way how to resolve this ?