I don't understand the flow


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)



The PIN-based auth is just a result of using “oob” in your application settings page. If you change that value to an URL, users will be redirected to that URL (or the value of oauth_callback if you send it when getting a request token) when they approve your application.