Create Twitter class
Add twitter login button to popup
Prepare Twitter OAuth
Request request token to Twitter
Extract oauth token query string from response
Extract function get query oauth token from response text
Open Twitter authorize page with new tab
Create blank method "Twitter.hasRequestToken"
Implement Twitter.hasRequestToken method
Add variable for request token

I want a Twitter object to have state.
Create Twitter instance on background page
Set request token to Twitter object when get twitter request token
Hide form when user has not been authorized
Create form html for sending pincode to twitter

Hide and show html elements each Twitter instance state
Create blank function Twitter.sendPincode

This function return false. Remove div outer form.
Add a param to Twitter.sendPincode
Save request token only value to Twitter object

Before commit, saved request token is key=value format.
Request access token to Twitter
Extract function creating Oauth instance
Set access token to OAuth object