Add a Twitter OAuth1 adapter
Summary:
Ref T3687. This builds on previous work to add the 3-legged OAuth1 workflow on top of the OAuth1Future.
Since Twitter is the other major OAuth1 provider and is dramatically more straightforward than JIRA and has better documentation and error messages, I used it as the initial implementation rather than JIRA. I'll follow up with JIRA in a diff or two.
Test Plan:
Used this script to perform 3-legged OAuth 1 with Twitter:
<?php require_once dirname(__FILE__).'/__init_script__.php'; $adapter = id(new PhutilAuthAdapterOAuthTwitter()) ->setCallbackURI('http://local.aphront.com:8080/auth/login/twitter:twitter.com/') ->setConsumerKey('WQULev7T26MjgSDyurDQ') ->setConsumerSecret('wGvWIzjzCM5azRNJRpw9JBCJDm7hsxgQ0pBIYoGaLI'); $clean_adapter = clone $adapter; echo "Open your browser and visit this URL:\n\n"; echo " ".$adapter->getClientRedirectURI()."\n"; $response = phutil_console_prompt("Where does that redirect you?"); $response_uri = new PhutilURI($response); $params = $response_uri->getQueryParams(); $clean_adapter->setToken(idx($params, 'oauth_token')); $clean_adapter->setVerifier(idx($params, 'oauth_verifier')); var_dump($clean_adapter->getAccountID());
Got my account ID out at the end.
Reviewers: btrahan
Reviewed By: btrahan
CC: aran
Maniphest Tasks: T3687
Differential Revision: https://secure.phabricator.com/D6703