I am currently creating a Twitter client application. It's just like Tweetdeck or something similar. The different is it's web based and it uses Codeigniter and Elliot Haughin Twitter Library.
I was able to do Oauth and call the twitter home_timeline, user_timeline, and mentions using serverside script. Also, I was able to display that data on the webpage and refresh it every 30 seconds using Jquery.
The problem is the Twitter RESTAPI rate limitation only gives a specific IP address 150 request per hour. With the 30 per second ajax call I made via Jquery, it make my server able to do 120 request to twitter API. The rest 30 requests left is not a problem if I have only one user assuming he/she is only make update status less than 30 req per hour. But, I am sure the more serious problem will occur when I have more user registered to my server.
A friend suggested me to call twitter API directly from jquery so the server side don't need to make a call. It works, but only for public method such as displaying user_timeline. When I tried to call the home_timeline or mentions, the twitter return "401 - authorized error". I understand that the call need OAuth to fulfill the request.
My questions:
Is there any possible way to make a call to authenticated API method directly from Javascript? if it so, how to do it? (i've searched and googling for days but can't find practical solution)
If it so, do I need to include my user request token and secret token along with the call?
Is it safe to include the tokens within javascript?
Please help me. I really appreciate any solution from you guys.
Best Regard