Does TWRequest iOS API support application-only authentication?

515 views Asked by At

If iOS user has no twitter accounts, is it possible to use application-only authentication via TWRequest for apis like getting a user's timeline? (user_timeline.json)?

I am currently getting http status 400 with the user_timeline.json API when there are no twitter accounts setup on the iOS device.

2

There are 2 answers

0
enricmacias On

Look at this answer: iOS Twitter User-Timeline fetching with v1.1 API

Anyway, since iOS 5 and Twitter REST API v1.1 things became quite complicated to retrieve any information from a device without using an account.

My solution was to add a UIWebView (instead of the ideal UITableView). And then developed a PHP website (a table with tweets) retrieving the timeline information from Twitter to my server.

0
nst On

You cannot use TWRequest directly since TWRequest requires an instance of ACAccount. This acAccount is optional according to documentation and Apple implementation could totally have handled the app-only flow when acAccount is nil, but unfortunately it's not the case.

Nevertheless, you can use the STTwitter library to retrieve a user timeline without user's context.

Code snippet here.