0

I had originally posted a question about what API to use in regards to making a SharePoint 2010 timer job able to access the twitter API and chose the Spring Social .NET api and have run into another roadblock.

I cannot get the OAuth handshake or 'dance' to work.

I have the consumer key and secret linked to my account, as well as an access token and secret, but any time I try to initialize a TwitterServiceProvider object, any time I attempt to query I get a 401 error.

The console/mvc and wp7.1 examples provided dont give much insight how I can get this code (which should run with no human involvement) to work.

Does anyone have any good resources regarding this?

Thanks in advance

John S
  • 464
  • 1
  • 8
  • 23

1 Answers1

2

If you already have access token value and secret, you can do something like that:

ITwitter twitter = new TwitterTemplate("consumerKey", "consumerSecret", "accessTokenValue", "accessTokenSecret");
// twitterApi.UserOperations.GetUserProfile();

that is equivalent to :

TwitterServiceProvider serviceProvider = new TwitterServiceProvider("consumerKey", "consumerSecret");
ITwitter twitterApi = serviceProvider.GetApi("accessTokenValue", "accessTokenSecret");
// twitterApi.UserOperations.GetUserProfile();

How do you get the access token secret and value?

bbaia
  • 1,193
  • 7
  • 8
  • I am getting this error from Visual Studio when I try to debug..The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. – John S Jan 16 '13 at 16:00
  • Oh, and I got the access token and secret from dev.twitter.com – John S Jan 16 '13 at 20:01
  • It is possible that the SSL/TLS connection issue is due to a blockage between my server and the internet as I do not manage them. I will try this method in a console app at home, and if that works I have to wait until the server team removes the restrictions. – John S Jan 16 '13 at 21:50
  • Im going to accept this answer as I tried at home and it worked. I will forward this issue to the people who manage the server and get them to fix it. Thanks! – John S Jan 17 '13 at 18:13