This project has moved and is read-only. For the latest updates, please go here.

Using Hammock and Linqtotwitter

Nov 28, 2013 at 5: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 8: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 2, 2013 at 12:05 AM
Edited Dec 2, 2013 at 12:05 AM
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 ?