I want to show a “Connect with Twitter” button in my app. Here is an example (From Grooveshark)

When you click that button, this window shows up
I want my app to do the same. I’m using Java (Grails) for my webapp, but all the Twitter libraries for java (Like Twitter4J or Scribe) use PIN-Based auth. I don’t understand how the flow of my authentication must be to replicate this behavior.
The front-end of my page relies on Javascript, but obviously i can’t access to the api directly with JS (so i must access it with Java)
Thanks!