Help With Credentials and Getting Started

Nov 11, 2014 at 9:40 AM
Hello, I am attempting to access the a set of the most recent tweets from my timeline. However I am not sure if I am even accessing Twitter using the correct code.
TwitterCredentials.SetCredentials(consumerKey, consumerSecret, oauthAccessToken, oauthAccessTokenSecret);
TwitterCredentials.ApplicationCredentials = TwitterCredentials.CreateCredentials(consumerKey, consumerSecret, oauthAccessToken, oauthAccessTokenSecret);

var timelineParameter = Timeline.CreateHomeTimelineRequestParameter();
timelineParameter.ExcludeReplies = true;
timelineParameter.TrimUser = true;
var tweets = Timeline.GetHomeTimeline(timelineParameter);
I am attempting to run this code in an asp.net webusercontrol and the main problem I am having is that my tweets variable is always null.

This probably a dumb question but I feel as though my control is never actually connecting to twitter because I am not using the correct methods.

Thank you for your help
Nov 11, 2014 at 2:45 PM
Hi, I have now managed to gain access to my twitter account and read from the timeline as I required. However, I was wondering if there is a way to do this without redirecting the user to twitter in order grant access to the application.

Basically what I want to achieve is displaying tweets from my own twitter account on a website. I am not trying to access the users twitter account. Unfortunately I cannot use the embed timeline functionality provided by twitter as I need server side access to the timeline information.
Nov 11, 2014 at 3:13 PM
Ok Nevermind I figured it out. Just didn't quite have the credentials set up correctly. Here is the code for anyone in future who is as blind as me!! Great API anyway thanks a bunch
            IOAuthCredentials cred = TwitterCredentials.CreateCredentials(oauthAccessToken, oauthAccessTokenSecret, consumerKey, consumerSecret);
            TwitterCredentials.SetCredentials(cred);

            var loggedUser = User.GetLoggedUser();
            var timeline = loggedUser.GetUserTimeline();
Marked as answer by andyw92 on 11/11/2014 at 7:14 AM
Nov 11, 2014 at 4:16 PM
Hi andy,

Sorry for not having help you before. I have been working.
I am happy to hear that you fixed your problem.

Please do not hesitate to ask questions on this forum again. I rarely take more than a day to reply.

Kind Regards,
Linvi