Update: This article was written in 2009 and Twitter4J has significantly changed since that time. Several visitors have said that the instructions here do not reflect the most recent method names in Twitter4J. It seems that the newest version -- 2.2.x -- is incompatible with 2.1.x. You can view the official version logs for more info.
I hope to find time to update this article in the near future. Until then, I believe the process described in the article is still valid.
Adventures of Twitter Integration
So, it turns out that the timing of my new blog couldn't be better. I actually have something valuable to share!
Recently, I was tasked with integrating Twitter into a website that I work on (RinkTime.com). I initially thought it would be a piece of cake because there's always another developer out there who has shared code for a similar concept. Imagine my surprise (and ultimately, frustration) when there wasn't any example or even good documentation to learn from.
Well, I finally figured it out and now I'd like to share my knowledge with the ColdFusion community.
Pages: 1 2
@jibu That’s good to hear! Hopefully it’s a quick fix for those who need it.
UPDATE: I just spent the last few hours upgrading one of my projects to Twitter4J 2.2.3. It’s quite different, but not all that difficult to understand once you get your head around it. Look for an updated blog post soon! (That’s my public announcement to light a fire under my butt and get the post done quickly.)
Hi Rob,
I have done exactly the same but after the log-in to twitter it redirects to my page but my session gets expired can you suggest something why it is happening or what could be the reason. I checked with fiddler the redirection is taking place but the session expires. Only one thing I found that the URL redirection takes place using Http:// but our site use Https://, is that the reason why session expires?
Rob,
Did you figure it out with 2.2.3? My app which following your instructions worked excellent for a year is now broken. Swapped out twitter4j versions but now get an error on the setOAuthConsumer step…
Hi Rob, I posted a question on Stack Overflow here and they pointed me to your blog, which actually I’d already read. But, now that I’m here again, I wonder if you have any ideas. Basically, I’m trying to use jQuery/ajax to open up a Twitter authorisation page and get the user’s access tokens in return. However, with oAuth, you have to provide a callbackURL.
This is what I have so far:
$.getJSON(cfcRoot + "/twitter.cfc?method=getRequestURL&returnformat=json, {"user_id":user_id}, function(res,code) {
openWindow(res); //pops up twitter auth window
// here I want to get the auth access tokens for saving to db
});
Any ideas would be greatly appreciated. I’m thinking along the lines of opening the auth window in an iframe with jQuery, then getting the results I need, but not sure.
Paul