- Timestamp:
- Jan 9, 2014, 6:11:33 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/oAuth/include/hybridauth/Hybrid/Providers/Twitter.php
r20293 r26555 18 18 parent::initialize(); 19 19 20 // Provider api end-points 21 $this->api->api_base_url = "https://api.twitter.com/1 /";20 // Provider api end-points 21 $this->api->api_base_url = "https://api.twitter.com/1.1/"; 22 22 $this->api->authorize_url = "https://api.twitter.com/oauth/authenticate"; 23 23 $this->api->request_token_url = "https://api.twitter.com/oauth/request_token"; 24 24 $this->api->access_token_url = "https://api.twitter.com/oauth/access_token"; 25 25 26 if ( isset( $this->config['api_version'] ) && $this->config['api_version'] ){ 27 $this->api->api_base_url = "https://api.twitter.com/{$this->config['api_version']}/"; 28 } 29 30 if ( isset( $this->config['authorize'] ) && $this->config['authorize'] ){ 31 $this->api->authorize_url = "https://api.twitter.com/oauth/authorize"; 32 } 33 26 34 $this->api->curl_auth_header = false; 27 35 } 36 37 /** 38 * begin login step 39 */ 40 function loginBegin() 41 { 42 $tokens = $this->api->requestToken( $this->endpoint ); 43 44 // request tokens as recived from provider 45 $this->request_tokens_raw = $tokens; 46 47 // check the last HTTP status code returned 48 if ( $this->api->http_code != 200 ){ 49 throw new Exception( "Authentification failed! {$this->providerId} returned an error. " . $this->errorMessageByStatus( $this->api->http_code ), 5 ); 50 } 51 52 if ( ! isset( $tokens["oauth_token"] ) ){ 53 throw new Exception( "Authentification failed! {$this->providerId} returned an invalid oauth token.", 5 ); 54 } 55 56 $this->token( "request_token" , $tokens["oauth_token"] ); 57 $this->token( "request_token_secret", $tokens["oauth_token_secret"] ); 58 59 // redirect the user to the provider authentication url with force_login 60 if ( isset( $this->config['force_login'] ) && $this->config['force_login'] ){ 61 Hybrid_Auth::redirect( $this->api->authorizeUrl( $tokens, array( 'force_login' => true ) ) ); 62 } 63 64 // else, redirect the user to the provider authentication url 65 Hybrid_Auth::redirect( $this->api->authorizeUrl( $tokens ) ); 66 } 28 67 29 68 /**
Note: See TracChangeset
for help on using the changeset viewer.