This project has moved. For the latest updates, please go here.

Using Hammock and Linqtotwitter

Nov 28, 2013 at 4:19 PM

I would like to know if it is possible to use Hammock in particularly the :
and then use linqtotwitter .

I managed to authentificate just using hammock, but then I would like to use linqtotwitter and of course the the TwitterContext class.

How can I do to use both Hammock and linqtotwitter ?

Thank you very much!
Nov 29, 2013 at 7:21 PM

LINQ to Twitter uses authorizers with credentials. The easiest approach here is to derive a class from an existing LINQ to Twitter authorizer. Add a parameter to the constructor that takes an instance of a Hammock object that holds the credentials you just authorized with. Inside of that constructor, read from that Hammock object and populate credentials.

Then in your code, you can do OAuth with Hammock, pass the appropriate object instance to your new LINQ to Twitter authorizer, and then pass that authorizer instance to the TwitterContext constructor. The key is to make sure you populate all 4 credentials.

@JoeMayo on Twitter
Dec 1, 2013 at 11:05 PM
Edited Dec 1, 2013 at 11:05 PM
Hi, Here is the class that I Created :
public class OAuthWithHammock : PinAuthorizer

public OAuthWithHammock(OAuthCredentials otc ){

    Credentials = new InMemoryCredentials
        ConsumerKey = otc.ConsumerKey,
        ConsumerSecret = otc.ConsumerSecret,
        AccessToken = otc.Token ,
        OAuthToken = otc.TokenSecret  


    //Credentials = new SingleUserInMemoryCredentials

    //    ConsumerKey = otc.ConsumerKey,
    //    ConsumerSecret = otc.ConsumerSecret,
    //    AccessToken = otc.Token,
    //    TwitterAccessTokenSecret = otc.TokenSecret



then I used the TwitterContext Like That :
  OAuthWithHammock  OWH = new OAuthWithHammock(credentials);
                var twitterCtx = new TwitterContext(OWH);

                 response =>

(where credentials is a OAuthCredentials hammock object )

Then no tweet was created, but the app didn't crash no error appeared.

Should I Derive The OAuthWithHammock from another Authorizer? or should i populate credentils in another way, what went wrong ?