Skip to content

Commit ba5cbaf

Browse files
committed
authtwitter: Change API endpoint to use https://api.twitter.com/ .
This is specified at: http://dev.twitter.com/pages/auth#at-twitter Thanks to Andjelko Horvat for fixing this. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2774 44740490-163a-0410-bde0-09ae8108e29a
1 parent 88e1dd7 commit ba5cbaf

1 file changed

Lines changed: 4 additions & 13 deletions

File tree

modules/authtwitter/lib/Auth/Source/Twitter.php

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function authenticate(&$state) {
7171
$consumer = new sspmod_oauth_Consumer($this->key, $this->secret);
7272

7373
// Get the request token
74-
$requestToken = $consumer->getRequestToken('http://twitter.com/oauth/request_token');
74+
$requestToken = $consumer->getRequestToken('https://api.twitter.com/oauth/request_token');
7575
SimpleSAML_Logger::debug("Got a request token from the OAuth service provider [" .
7676
$requestToken->key . "] with the secret [" . $requestToken->secret . "]");
7777

@@ -83,17 +83,12 @@ public function authenticate(&$state) {
8383
$session->setData('oauth', 'oauth', $oauthState);
8484

8585
// Authorize the request token
86-
$consumer->getAuthorizeRequest('http://twitter.com/oauth/authenticate', $requestToken);
86+
$consumer->getAuthorizeRequest('https://api.twitter.com/oauth/authenticate', $requestToken);
8787

8888
}
8989

9090

91-
9291
public function finalStep(&$state) {
93-
94-
95-
96-
9792
$requestToken = unserialize($state['requestToken']);
9893

9994
#echo '<pre>'; print_r($requestToken); exit;
@@ -104,19 +99,16 @@ public function finalStep(&$state) {
10499
$requestToken->key . "] with the secret [" . $requestToken->secret . "]");
105100

106101
// Replace the request token with an access token
107-
$accessToken = $consumer->getAccessToken('http://twitter.com/oauth/access_token', $requestToken);
102+
$accessToken = $consumer->getAccessToken('https://api.twitter.com/oauth/access_token', $requestToken);
108103
SimpleSAML_Logger::debug("Got an access token from the OAuth service provider [" .
109104
$accessToken->key . "] with the secret [" . $accessToken->secret . "]");
110105

111-
112-
113-
$userdata = $consumer->getUserInfo('http://twitter.com/account/verify_credentials.json', $accessToken);
106+
$userdata = $consumer->getUserInfo('https://api.twitter.com/account/verify_credentials.json', $accessToken);
114107

115108
$attributes = array();
116109
foreach($userdata AS $key => $value) {
117110
if (is_string($value))
118111
$attributes['twitter.' . $key] = array((string)$value);
119-
120112
}
121113

122114
if (array_key_exists('screen_name', $userdata) ) {
@@ -126,7 +118,6 @@ public function finalStep(&$state) {
126118
if (array_key_exists('id_str', $userdata) )
127119
$attributes['twitter_targetedID'] = array('http://twitter.com!' . $userdata['id_str']);
128120

129-
130121
$state['Attributes'] = $attributes;
131122
}
132123

0 commit comments

Comments
 (0)