kubi
kubi

Reputation: 49354

How do I authenticate for Twitter friends_timeline?

This is my first web API project, so I hope the solution to this isn't blindingly obvious.

// Contstruct the http request
NSString *urlString = [NSString stringWithFormat:@"http://%@:%@@twitter.com/statuses/user_timeline/%@.xml?count=5", username, password, friend];
NSURL *url = [NSURL URLWithString:urlString];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];

// Recive the data from the synchronous request
NSData *urlData;
urlData = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:nil error:nil];

The results returned from this query look fine except they don't reflect if I've favorited them or not. All tweets return "false", even if the authenticating user has starred them. I'm fairly confident that I'm authenticating correctly as code further down that does require authentication behaves correctly.

Upvotes: 1

Views: 803

Answers (2)

kubi
kubi

Reputation: 49354

As dirkgently pointed out in the previous post, the XML was out of sync with reality. With no changes to the code at all, things that weren't working this morning were working tonight. Thanks Dirk!

Upvotes: 0

dirkgently
dirkgently

Reputation: 111120

Add a Basic Authentication header field where you specify the username/password. Most libraries have a setCredentials() method though.

Upvotes: 1

Related Questions