OAuth and logging on to Twitter

We'll take a detour into LoginController in just a moment, but first, let's make sure we understand what's going on here. To log on to Twitter on behalf of a user, we need to generate an OAuth request token from which we get an authorization URL. The details of which are hidden nicely behind the Twitter4J API, but it is, basically, the OAuth authorization URL listed on the Application Management page with a request token passed as a query string. As we'll see, this URL is opened in a WebView, which prompts the user to authenticate against Twitter, and then authorize the application (or decline to):

If the user ...

Get Java 9 Programming Blueprints now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.