diff --git a/README.md b/README.md index 07f814414..a960a080e 100644 --- a/README.md +++ b/README.md @@ -52,10 +52,3 @@ at [http://hybridauth.sourceforge.net/userguide.html](http://hybridauth.sourcefo **To get help and support**, join us and participate in the hybriauth discussion group at [http://hybridauth.sourceforge.net/support.html](http://hybridauth.sourceforge.net/support.html) - -## Quick Start - -- CHMOD 777 config.php -- Run install.php. -- Once configured, delete install.php. -That's it! \ No newline at end of file diff --git a/additional-providers/hybridauth-Identica/Providers/Identica.php b/additional-providers/hybridauth-Identica/Providers/Identica.php index ecb7d691f..26f702c8e 100644 --- a/additional-providers/hybridauth-Identica/Providers/Identica.php +++ b/additional-providers/hybridauth-Identica/Providers/Identica.php @@ -1,106 +1,27 @@ config["keys"]["key"] || ! $this->config["keys"]["secret"] ) - { - throw new Exception( "Your application key and secret are required in order to connect to {$this->providerId}.", 4 ); - } - - require_once Hybrid_Auth::$config["path_libraries"] . "OAuth/OAuth.php"; - require_once Hybrid_Auth::$config["path_libraries"] . "TwitterCompatible/TwitterCompatibleClient.php"; - require_once Hybrid_Auth::$config["path_libraries"] . "TwitterCompatible/Identica.php"; - - if( $this->token( "access_token" ) && $this->token( "access_token_secret" ) ) - { - $this->api = new Identica_Client - ( - $this->config["keys"]["key"], $this->config["keys"]["secret"], - $this->token( "access_token" ), $this->token( "access_token_secret" ) - ); - } - } - - /** - * begin login step - */ - function loginBegin() - { - $this->api = new Identica_Client( $this->config["keys"]["key"], $this->config["keys"]["secret"] ); - - $tokz = $this->api->getRequestToken( $this->endpoint ); - - // check the last HTTP status code returned - if ( $this->api->http_code != 200 ) - { - throw new Exception( "Authentification failed! {$this->providerId} returned an error: " . $this->api->lastErrorMessageFromStatus(), 5 ); - } - - if ( ! isset( $tokz["oauth_token"] ) ) - { - throw new Exception( "Authentification failed! {$this->providerId} returned an invalid oauth token.", 5 ); - } - - $this->token( "request_token" , $tokz["oauth_token"] ); - $this->token( "request_token_secret", $tokz["oauth_token_secret"] ); - - # redirect user to twitter - Hybrid_Auth::redirect( $this->api->getAuthorizeURL( $tokz ) ); - } - - /** - * finish login step - */ - function loginFinish() - { - $oauth_token = @ $_REQUEST['oauth_token']; - $oauth_verifier = @ $_REQUEST['oauth_verifier']; - - if ( ! $oauth_token || ! $oauth_verifier ) - { - throw new Exception( "Authentification failed! {$this->providerId} returned an invalid oauth verifier.", 5 ); - } - - $this->api = new Identica_Client( - $this->config["keys"]["key"], $this->config["keys"]["secret"], - $this->token( "request_token" ), $this->token( "request_token_secret" ) - ); - - $tokz = $this->api->getAccessToken( $oauth_verifier ); - - // check the last HTTP status code returned - if ( $this->api->http_code != 200 ) - { - throw new Exception( "Authentification failed! {$this->providerId} returned an error: " . $this->api->lastErrorMessageFromStatus(), 5 ); - } - - if ( ! isset( $tokz["oauth_token"] ) ) - { - throw new Exception( "Authentification failed! {$this->providerId} returned an invalid access token.", 5 ); - } - - $this->token( "access_token" , $tokz['oauth_token'] ); - $this->token( "access_token_secret" , $tokz['oauth_token_secret'] ); + parent::initialize(); - // set user as logged in - $this->setUserConnected(); + // provider api end-points + $this->api->api_base_url = "https://identi.ca/api/"; + $this->api->authorize_url = "https://identi.ca/api/oauth/authorize"; + $this->api->request_token_url = "https://identi.ca/api/oauth/request_token"; + $this->api->access_token_url = "https://identi.ca/api/oauth/access_token"; } /** @@ -108,12 +29,12 @@ function loginFinish() */ function getUserProfile() { - $response = $this->api->get( 'account/verify_credentials' ); + $response = $this->api->get( 'account/verify_credentials.json' ); // check the last HTTP status code returned if ( $this->api->http_code != 200 ) { - throw new Exception( "User profile request failed! {$this->providerId} returned an error: " . $this->api->lastErrorMessageFromStatus(), 6 ); + throw new Exception( "User profile request failed! {$this->providerId} returned an error. " . $this->errorMessageByStatus( $this->api->http_code ), 6 ); } if ( ! is_object( $response ) ) @@ -140,12 +61,12 @@ function getUserProfile() function getUserContacts( $arguments = ARRAY() ) { $parameters = array( 'cursor' => '-1' ); - $response = $this->api->get( 'friends/ids', $parameters ); + $response = $this->api->get( 'friends/ids.json', $parameters ); // check the last HTTP status code returned if ( $this->api->http_code != 200 ) { - throw new Exception( "User contacts request failed! {$this->providerId} returned an error: " . $this->api->lastErrorMessageFromStatus() ); + throw new Exception( "User contacts request failed! {$this->providerId} returned an error. " . $this->errorMessageByStatus( $this->api->http_code ) ); } if( ! $response ){ @@ -157,12 +78,12 @@ function getUserContacts( $arguments = ARRAY() ) // donno if users/lookup is supported by identica.. to do foreach( $response as $item ){ $parameters = array( 'user_id' => $item ); - $responseud = $this->api->get( 'users/show', $parameters ); + $responseud = $this->api->get( 'users/show.json', $parameters ); // check the last HTTP status code returned if ( $this->api->http_code != 200 ) { - throw new Exception( "User contacts request failed! {$this->providerId} returned an error: " . $this->api->lastErrorMessageFromStatus() ); + throw new Exception( "User contacts request failed! {$this->providerId} returned an error. " . $this->errorMessageByStatus( $this->api->http_code ) ); } if( $responseud ){ @@ -189,12 +110,12 @@ function setUserStatus( $arguments = ARRAY() ) $status = $arguments[0]; // status content $parameters = array( 'status' => $status ); - $response = $this->api->post( 'statuses/update', $parameters ); + $response = $this->api->post( 'statuses/update.json', $parameters ); // check the last HTTP status code returned if ( $this->api->http_code != 200 ) { - throw new Exception( "Update user status update failed! {$this->providerId} returned an error: " . $this->api->lastErrorMessageFromStatus() ); + throw new Exception( "Update user status update failed! {$this->providerId} returned an error. " . $this->errorMessageByStatus( $this->api->http_code ) ); } } @@ -206,16 +127,16 @@ function setUserStatus( $arguments = ARRAY() ) function getUserActivity( $arguments = ARRAY() ) { if( isset( $arguments[0] ) && $arguments[0] == "me" ){ - $response = $this->api->get( 'statuses/user_timeline' ); + $response = $this->api->get( 'statuses/user_timeline.json' ); } else{ - $response = $this->api->get( 'statuses/home_timeline' ); + $response = $this->api->get( 'statuses/home_timeline.json' ); } // check the last HTTP status code returned if ( $this->api->http_code != 200 ) { - throw new Exception( "User activity stream request failed! {$this->providerId} returned an error: " . $this->api->lastErrorMessageFromStatus() ); + throw new Exception( "User activity stream request failed! {$this->providerId} returned an error. " . $this->errorMessageByStatus( $this->api->http_code ) ); } if( ! $response ){ diff --git a/additional-providers/hybridauth-Identica/thirdparty/TwitterCompatible/Identica.php b/additional-providers/hybridauth-Identica/thirdparty/TwitterCompatible/Identica.php deleted file mode 100644 index da97c84a1..000000000 --- a/additional-providers/hybridauth-Identica/thirdparty/TwitterCompatible/Identica.php +++ /dev/null @@ -1,9 +0,0 @@ - public read-only access (includes public user profile info, public repo info, and gists). public $scope = ""; - /** + /** * IDp wrappers initializer */ function initialize() { parent::initialize(); - // Provider apis end-points + // Provider api end-points $this->api->api_base_url = "https://api.github.com/"; $this->api->authorize_url = "https://github.com/login/oauth/authorize"; $this->api->token_url = "https://github.com/login/oauth/access_token"; } - /** + /** * load the user profile from the IDp api client */ function getUserProfile() @@ -42,14 +38,14 @@ function getUserProfile() throw new Exception( "User profile request failed! {$this->providerId} returned an invalide response.", 6 ); } - $this->user->profile->identifier = @ $data->id; - $this->user->profile->displayName = @ $data->name; - $this->user->profile->description = @ $data->bio; - $this->user->profile->photoURL = @ $data->avatar_url; - $this->user->profile->profileURL = @ $data->html_url; - $this->user->profile->email = @ $data->email; - $this->user->profile->webSiteURL = @ $data->blog; - $this->user->profile->region = @ $data->location; + $this->user->profile->identifier = @ $data->id; + $this->user->profile->displayName = @ $data->name; + $this->user->profile->description = @ $data->bio; + $this->user->profile->photoURL = @ $data->avatar_url; + $this->user->profile->profileURL = @ $data->html_url; + $this->user->profile->email = @ $data->email; + $this->user->profile->webSiteURL = @ $data->blog; + $this->user->profile->region = @ $data->location; if( ! $this->user->profile->displayName ){ $this->user->profile->displayName = @ $data->login; diff --git a/additional-providers/hybridauth-gowalla/Providers/Gowalla.php b/additional-providers/hybridauth-gowalla/Providers/Gowalla.php index 0a9dfaa4b..57f2fa8fc 100644 --- a/additional-providers/hybridauth-gowalla/Providers/Gowalla.php +++ b/additional-providers/hybridauth-gowalla/Providers/Gowalla.php @@ -1,12 +1,8 @@ config["keys"]["key"] || ! $this->config["keys"]["secret"] ) - { - throw new Exception( "Your application key and secret are required in order to connect to {$this->providerId}.", 4 ); - } - - require_once Hybrid_Auth::$config["path_libraries"] . "OAuth/OAuth.php"; - require_once Hybrid_Auth::$config["path_libraries"] . "TwitterCompatible/TwitterCompatibleClient.php"; - require_once Hybrid_Auth::$config["path_libraries"] . "TwitterCompatible/Tumblr.php"; - - if( $this->token( "access_token" ) && $this->token( "access_token_secret" ) ) - { - $this->api = new Tumblr_Client - ( - $this->config["keys"]["key"], $this->config["keys"]["secret"], - $this->token( "access_token" ), $this->token( "access_token_secret" ) - ); - } - } - - /** - * begin login step - */ - function loginBegin() - { - $this->api = new Tumblr_Client( $this->config["keys"]["key"], $this->config["keys"]["secret"] ); - - $tokz = $this->api->getRequestToken( $this->endpoint ); - - // check the last HTTP status code returned - if ( $this->api->http_code != 200 ) - { - throw new Exception( "Authentification failed! {$this->providerId} returned an error: " . $this->api->lastErrorMessageFromStatus(), 5 ); - } - - if ( ! isset( $tokz["oauth_token"] ) ) - { - throw new Exception( "Authentification failed! {$this->providerId} returned an invalid oauth token.", 5 ); - } + parent::initialize(); - $this->token( "request_token" , $tokz["oauth_token"] ); - $this->token( "request_token_secret", $tokz["oauth_token_secret"] ); - - # redirect user to twitter - Hybrid_Auth::redirect( $this->api->getAuthorizeURL( $tokz ) ); - } - - /** - * finish login step - */ - function loginFinish() - { - $oauth_token = @ $_REQUEST['oauth_token']; - $oauth_verifier = @ $_REQUEST['oauth_verifier']; - - if ( ! $oauth_token || ! $oauth_verifier ) - { - throw new Exception( "Authentification failed! {$this->providerId} returned an invalid oauth verifier.", 5 ); - } - - $this->api = new Tumblr_Client( - $this->config["keys"]["key"], $this->config["keys"]["secret"], - $this->token( "request_token" ), $this->token( "request_token_secret" ) - ); - - $tokz = $this->api->getAccessToken( $oauth_verifier ); - - // check the last HTTP status code returned - if ( $this->api->http_code != 200 ) - { - throw new Exception( "Authentification failed! {$this->providerId} returned an error: " . $this->api->lastErrorMessageFromStatus(), 5 ); - } - - if ( ! isset( $tokz["oauth_token"] ) ) - { - throw new Exception( "Authentification failed! {$this->providerId} returned an invalid access token.", 5 ); - } - - $this->token( "access_token" , $tokz['oauth_token'] ); - $this->token( "access_token_secret" , $tokz['oauth_token_secret'] ); - - // set user as logged in - $this->setUserConnected(); + // provider api end-points + $this->api->api_base_url = "http://www.tumblr.com/"; + $this->api->authorize_url = "http://www.tumblr.com/oauth/authorize"; + $this->api->request_token_url = "http://www.tumblr.com/oauth/request_token"; + $this->api->access_token_url = "http://www.tumblr.com/oauth/access_token"; } /** @@ -113,7 +34,7 @@ function getUserProfile() // check the last HTTP status code returned if ( $this->api->http_code != 200 ) { - throw new Exception( "User profile request failed! {$this->providerId} returned an error: " . $this->api->lastErrorMessageFromStatus(), 6 ); + throw new Exception( "User profile request failed! {$this->providerId} returned an error: " . $this->errorMessageByStatus( $this->api->http_code ), 6 ); } try{ @@ -134,7 +55,31 @@ function getUserProfile() return $this->user->profile; } - + + /** + * load the current logged in user contacts list from the IDp api client + */ + function getUserContacts() + { + throw new Exception( "Provider does not support this feature.", 8 ); + } + + /** + * return the user activity stream + */ + function getUserActivity( $stream ) + { + throw new Exception( "Provider does not support this feature.", 8 ); + } + + /** + * return the user activity stream + */ + function setUserStatus( $status ) + { + throw new Exception( "Provider does not support this feature.", 8 ); + } + /** * Utility function, convert xml to array */ @@ -153,5 +98,5 @@ public function xml2array($xml) { } $arXML['children']=$t; return($arXML); - } + } } diff --git a/additional-providers/hybridauth-tumblr/thirdparty/TwitterCompatible/Tumblr.php b/additional-providers/hybridauth-tumblr/thirdparty/TwitterCompatible/Tumblr.php deleted file mode 100644 index 1d35d3c6f..000000000 --- a/additional-providers/hybridauth-tumblr/thirdparty/TwitterCompatible/Tumblr.php +++ /dev/null @@ -1,13 +0,0 @@ -authenticate( "facebook" ); @@ -18,38 +19,85 @@ } } + // logged in ? if( ! isset( $user_profile ) ){ ?>

-A basic example which show how to integrate Facebook Dialogs and stuff on your website side by side whith HybridAuth. Click the Signin link to start. +A VERY basic example which show how to integrate Facebook Javascript SDK side by side with HybridAuth. Click the Signin link to start.

-

Signin with facebook

- - +

Signin with facebook

-

Hi displayName; ?>

+ + + + + + + + + + + + + + +
- - - +
+Hybridauth library +Hi displayName; ?>,
your profile url is: profileURL; ?> +
+Hybridauth access tokens for Facebook: +
getAccessToken() ); ?>
+
-

-


- The invite friends may require some advanced facebook application configuration your side. To know more about FB.ui visit https://developers.facebook.com/docs/reference/javascript/FB.ui/ -

+
+ +
+Facebook JavaScript SDK +Your are logged in to this site with facebook and the Javascript SDK should be happy with it. +
+
+ +
+
+
+ + +
+
+Note: The invite friends may require some advanced facebook application configuration your side. To know more about FB.ui visit https://developers.facebook.com/docs/reference/javascript/FB.ui/ +
- + + + + +
+ +
+ + - +
-
-

Getting Started

-

To install HybridAuth, you can use the HybridAuth Auto Installer

+

HybridAuth Showcases

+ +

Getting Started

+

To install HybridAuth, you can use the HybridAuth Auto Installer.

You can also install HybridAuth manually by refering to Installation and Configuration sections at http://hybridauth.sourceforge.net/userguide.html

@@ -13,17 +15,14 @@

Getting Started


- - - - + + +

Available Examples and Demos

-

HybridAuth Examples and Demos

- +
- + - + - + - - + - +
1 - Hello world

A very simple sign-in script which will try to directly connect the user with Twitter then grab his complete profile and also access the twitter social api. @@ -33,7 +32,7 @@

HybridAuth Examples and Demos

2 - Widget integration

A simple user friendly sign-in interface (aka: provider selector UI) which you can integrate, customize, redesign and improve (and hopefully you will share some of your work with the comminuty). @@ -42,7 +41,7 @@

HybridAuth Examples and Demos

3 - Tiny Social Hub

This exapmle show how users can login with providers using HybridAuth. It also show how to grab their profile, update their status or to grab their freinds list from services such as facebook, twitter, myspace. @@ -50,28 +49,33 @@

HybridAuth Examples and Demos

4 - Sign-in/Sign-up users +4 - Sign-in/Sign-up Users

An attempt to put together an answer to how to sign-in/sign-up users using HybridAuth in an existing web application.

This exapmle provide a simple implementation of the whole sign-in/sign-up process on a MVC environment.

5 - Basic Facebook integration

-A basic example which show how to integrate Facebook Dialogs and stuff on your website side by side whith HybridAuth. +A VERY basic example which show how to integrate Facebook Javascript SDK side by side with HybridAuth.

+ +
+ + +


-

HybridAuth Open Source Social Sign On Library, 2011.

+

HybridAuth Library, 2011. http://hybridauth.sourceforge.net/

-