summaryrefslogtreecommitdiff
path: root/tests/oauth
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-10-06 19:05:31 -0700
committerZach Copley <zach@status.net>2010-10-06 19:05:31 -0700
commit5d5c4e8344ba8a16b7da36977693a3eec912880b (patch)
tree154a648103dce0f112fce4635cc1aa0e89c34b38 /tests/oauth
parentf97b863fd709135fb9f7bf7c756a1c6721e3e988 (diff)
Some more cleanup
Diffstat (limited to 'tests/oauth')
-rwxr-xr-xtests/oauth/getrequesttoken.php28
1 files changed, 15 insertions, 13 deletions
diff --git a/tests/oauth/getrequesttoken.php b/tests/oauth/getrequesttoken.php
index 11ec126b7..045d59716 100755
--- a/tests/oauth/getrequesttoken.php
+++ b/tests/oauth/getrequesttoken.php
@@ -33,12 +33,13 @@ foreach(array('consumer_key', 'consumer_secret', 'apiroot', 'request_token_url')
}
}
-$testConsumer = new OAuthConsumer($ini['consumer_key'], $ini['consumer_secret']);
+$testConsumer = new OAuthConsumer($ini['consumer_key'], $ini['consumer_secret']);
$requestTokenUrl = $ini['apiroot'] . $ini['request_token_url'];
-$parsed = parse_url($requestTokenUrl);
-$params = array();
+$parsed = parse_url($requestTokenUrl);
+$params = array();
+
parse_str($parsed['query'], $params);
-$params['oauth_callback'] = 'oob';
+$params['oauth_callback'] = 'oob'; // out-of-band
$hmac_method = new OAuthSignatureMethod_HMAC_SHA1();
@@ -59,22 +60,24 @@ try {
exit(1);
}
-$body = $r->getBody();
+$body = $r->getBody();
$tokenStuff = array();
+
parse_str($body, $tokenStuff);
-if (empty($tokenStuff['oauth_token'])) {
+$tok = $tokenStuff['oauth_token'];
+$confirmed = $tokenStuff['oauth_callback_confirmed'];
+
+if (empty($tokenStuff['oauth_token']) || empty($confirmed) || $confirmed != 'true') {
print "Error: $body\n";
exit(1);
}
-$authurl = $ini['apiroot'] . $ini['authorize_url'] . '?oauth_token=' . $tokenStuff['oauth_token'];
-print "\nSuccess!\n\n";
-print 'Request token : ' . $tokenStuff['oauth_token'] . "\n";
-print 'Request token secret : ' . $tokenStuff['oauth_token_secret'] . "\n";
-print "Authorize URL : $authurl\n";
+$authurl = $ini['apiroot'] . $ini['authorize_url'] . '?oauth_token=' . $tok;
-print "\nNow paste the Authorize URL into your browser and authorize the request token.\n";
+print "\nSuccess! ";
+print "Authorize URL:\n\n$authurl\n\n";
+print "Now paste the Authorize URL into your browser and authorize your temporary credentials.\n";
function httpRequest($url)
{
@@ -92,4 +95,3 @@ function httpRequest($url)
return $request->get($url);
}
-