i use linqtotwitter library, in my win forms application i can do api calls to twitter, but when i closed my application and reopen, i need again repeat enter pin code///
in twitter programm tweetdesc its need only once enter the pin? How i can do well as in the application itself?
i read:
After authorize, save the credentials associated with that user. Next time the user needs to perform an action with your app, grab the saved credentials and load all 4 credentials into the authorizer. When the authorizer has all 4 credentials, it no longer needs to perform the authorization process and you can perform queries without authorizing
BUT how do thise?
You can read credentials after calling CompleteAuthorizeAsync, like this:
So, what you need to do is have a way to store user information. For simplicity, I'll assume you're using a database. Your storage could also be a file in any format you choose. Assuming you're using a database, you should have a table that holds user information and you should know who the user is that is using your application. That user has an ID in your table and the table should have fields for oauthToken and oauthTokenSecret. You could also add fields for Twitter's UserID and ScreenName, but they aren't required for OAuth.
Notice that the code above gets a reference to the CredentialStore from the authorizer, pinAuth. This occurs after the call to CompleteAuthorizeAsync because the credentials are not available until after the OAuth process is complete. With the reference to credentials, read the OAuthToken and OAuthToken properties. Then write code to store the OAuthToken and OAuthTokenSecret credentials into the database, associated with the current user.
Now you have credentials stored for that user.
On subsequent queries, make sure that you've loaded the Authorizer with all four credentials: ConsumerKey, ConsumerSecret, OAuthToken, and OAuthTokenSecret. Here's an example:
Before instantiating the PinAuthorizer, check to see if you have an OAuthToken and OAuthTokenSecret for the current user. If you do, then populate the Authorizer's CredentialStore with them. If not, leave the OAuthToken and OAuthTokenSecret null so that LINQ to Twitter will go through the OAuth process to get the tokens. If you do have OAuthToken and OAuthTokenSecret and you assign them to CredentialStore properties, then LINQ to Twitter will not need to perform the OAuth process and you can use the authorizer to perform queries right away.