Sample code for 30+ languages & platforms
C#

Twitter PIN-Based Authorization (Step 2)

Demonstrates the 2nd step in Twitter PIN-based authorization using OAuth. A PIN should have already been obtained from Step 1. The PIN is the OAuth verifier used in combination with the consumer secret and consumer key to get the access token and token secret that will be used for subsequent Twitter requests (to do whatever the Twitter account owner has permitted your application to do..)

Chilkat C# Downloads

C#
bool success = false;

//  This example requires the Chilkat API to have been previously unlocked.
//  See Global Unlock Sample for sample code.

Chilkat.Http http = new Chilkat.Http();

http.OAuth1 = true;
http.OAuthConsumerKey = "my-consumer-key";
http.OAuthConsumerSecret = "my-consumer-secret";
http.OAuthVerifier = "the-PIN-obtained-from-Step1";

Chilkat.HttpRequest req = new Chilkat.HttpRequest();
req.HttpVerb = "POST";
req.ContentType = "application/x-www-form-urlencoded";

Chilkat.HttpResponse resp = new Chilkat.HttpResponse();
success = http.HttpReq("https://api.twitter.com/oauth/access_token",req,resp);
if (success == false) {
    Debug.WriteLine(http.LastErrorText);
    return;
}

if (resp.StatusCode == 200) {

    //  Get the access token and secret:

    string oauthToken = resp.UrlEncParamValue(resp.BodyStr,"oauth_token");
    Debug.WriteLine("Access token = " + oauthToken);

    string oauthTokenSecret = resp.UrlEncParamValue(resp.BodyStr,"oauth_token_secret");
    Debug.WriteLine("Token secret = " + oauthTokenSecret);

    //  Your application may now perform operations on the 
    //  Twitter account for whatever has been authorized.
    //  To do so, prior to sending the HTTP request, 
    //  set the OAuthToken and OAuthTokenSecret
    //  properties, and also make sure to clear OAuthVerifier property:
    http.OAuthToken = oauthToken;
    http.OAuthTokenSecret = oauthTokenSecret;
    http.OAuthVerifier = "";

    //  Now that the http object has valid property values
    //  for OAuthConsumerKey, OAuthConsumerSecret,
    //   OAuthToken, and OAuthTokenSecret, it can send authenticated
    //  Twitter requests to the user's Twitter account.

}
else {
    Debug.WriteLine(http.LastErrorText);
}