Yii Framework Forum: [MODULE] HybridAuth - Yii Framework Forum

Jump to content

  • (7 Pages)
  • +
  • « First
  • 4
  • 5
  • 6
  • 7
  • You cannot start a new topic
  • You cannot reply to this topic

[MODULE] HybridAuth Rate Topic: ***** 2 Votes

#101 User is offline   zerolimit 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 30-November 12

Posted 20 December 2012 - 11:16 PM

can anyone please upload a sample for working hybridauth with yii?

I've got too many errors, that i don't know where to start.
0

#102 User is offline   basem 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 07-October 12

Posted 25 December 2012 - 10:12 AM

One problem

Nice module and really saved lots of time for us.. however, I'm faced with an issue here and im not sure if all have the same thing:

When I click on any of the providers, it saves a record in DB without my confirmation (i.e. im unable to confirm/decline a selected provider) so it gets confirmed by default, even if I have already logged-into other providers by clicking save password
Any help please

Regards, Basem
0

#103 User is offline   basem 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 07-October 12

Posted 25 December 2012 - 10:58 AM

View Postzerolimit, on 20 December 2012 - 11:16 PM, said:

can anyone please upload a sample for working hybridauth with yii?

I've got too many errors, that i don't know where to start.


Go to http://www.yiiframew...ion/hybridauth/ and follow steps....
0

#104 User is offline   zerolimit 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 30-November 12

Posted 25 December 2012 - 08:46 PM

didn't i need something like hybridauthmodule.php to connect it to yii?

i've got this kind of error : Alias hybridauth.HybridauthModule is invalid. Make sure it points to an existing PHP file and the file is readable.

after trying to search for hybridauthmodule.php i've found this github.com/markvr/hybridauth

after i tried it, i get : HybridauthModule and its behaviors do not have a method or closure named getAdapter.

can someone point me where i'm go wrong?
0

#105 User is offline   TonyBoy 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 23-December 12

Posted 28 December 2012 - 12:35 PM

Hi,

Any ideas or clues what is the best way to integrate Hybridauth module into Yii user management extension?
http://www.yiiframew...ser-management/

Any help will be much appreciated!
0

#106 User is offline   cico 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 22-December 12

Posted 29 December 2012 - 12:37 PM

Hi, i'm new on this comunity and this is my first post.
This extension is very helpful, thank you at all developers for sharing the code.
I found two problems, or issues, that i can't resolve:

1) With Facebook Login, module redirect me to another page and not open popup, my config file is setted:
'import'=>array('application.helpers.*',
		'application.models.*',
		'application.components.*',
                 .....
                'application.modules.hybridauth.controllers.*',
)


and

'hybridauth' => array(
            'baseUrl' => '****//'. $_SERVER['SERVER_NAME'] . '/contest/index.php/hybridauth', 
            'withYiiUser' => true, // Set to true if using yii-user
            "providers" => array (  
                "facebook" => array ( 
                    "enabled" => true,
                    "keys"    => array ( "id" => "MYID", "secret" => "MYSECRET" ),
                    "scope"   => "email,publish_stream", 
                    "display" => "popup" //<- Open like popup layout but in the same page and not popup window without redirect
                ),
            )
        ),


2) If i press cancel on dialog authorization of the social I recive this error:

Authentification failed! The user denied your request.

/var/www/contest/protected/modules/hybridauth/Hybrid/Auth.php(153)

141         if( Hybrid_Error::hasError() ){ 
142             $m = Hybrid_Error::getErrorMessage();
143             $c = Hybrid_Error::getErrorCode();
144             $p = Hybrid_Error::getErrorPrevious();
145 
146             Hybrid_Logger::error( "Hybrid_Auth initialize: A stored Error found, Throw an new Exception and delete it from the store: Error#$c, '$m'" );
147 
148             Hybrid_Error::clearError();
149 
150             // try to provide the previous if any
151             // Exception::getPrevious (PHP 5 >= 5.3.0) ****://php.net/manual/en/exception.getprevious.php
152             if ( version_compare( PHP_VERSION, '5.3.0', '>=' ) && ($p instanceof Exception) ) { 
153                 throw new Exception( $m, $c, $p );
154             }
155             else{
156                 throw new Exception( $m, $c );
157             }
158         }
159 
160         Hybrid_Logger::info( "Hybrid_Auth initialize: no error found. initialization succeed." );
161 
162         // Endof initialize 
163     }
164 
165     // --------------------------------------------------------------------


Thank you

Thank you for the support.

Have a nice 2013 :)
0

#107 User is offline   cico 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 22-December 12

Posted 29 December 2012 - 03:23 PM

I think that to find a solution for open login windows popup it is necessary to create a js that allow us to do.
I found some example on the web (thinkdiff.net/facebook/create-facebook-popup-authentication-window-using-php-and-javascript/) and i change the widget view providers.php adding this:
<ul class='hybridauth-providerlist'>
	<?php foreach ($providers as $provider => $settings): ?>
		<?php if($settings['enabled'] == true): ?> 
			<li <?php if ($settings['active']==true): ?>
					class='active'					
				<?php else: ?>
					class='inactive'
				<?php endif; ?>
			>				
					<img id="hybridauth" class="<?php echo $provider ?>" src="<?php echo $assetsUrl ?>/images/<?php echo strtolower($provider)?>.png"/>

			</li>
		<?php endif; ?>
	<?php endforeach; ?>
</ul>
<script>
$('li.inactive img#hybridauth').click(function(){
		var provider = $(this).attr('class');
		start_auth( provider );
});
function start_auth( params ){
			var  screenX    = typeof window.screenX != 'undefined' ? window.screenX : window.screenLeft,
                 screenY    = typeof window.screenY != 'undefined' ? window.screenY : window.screenTop,
                 outerWidth = typeof window.outerWidth != 'undefined' ? window.outerWidth : document.body.clientWidth,
                 outerHeight = typeof window.outerHeight != 'undefined' ? window.outerHeight : (document.body.clientHeight - 22),
                 width    = 800,
                 height   = 500,
                 left     = parseInt(screenX + ((outerWidth - width) / 2), 10),
                 top      = parseInt(screenY + ((outerHeight - height) / 2.5), 10),
                 features = (
                    'width=' + width +
                    ',height=' + height +
                    ',left=' + left +
                    ',top=' + top
                  );
			var start_url = "<?php echo $baseUrl?>/default/login/?provider="+ params +"&return_to=<?php echo $this->config['baseUrl']; ?>" + "&_ts=" + (new Date()).getTime();
		window.open(
				start_url, 
				"Login With Facebook", 
				features
			);
		}
</script>


It work but i have a problem to set the Next url when a user return on site after the social authentication is right, to add a request like "success" or "cancel" that allow me to close the popup windows and reload the parent page.

Sorry for my english.
0

#108 User is offline   compugator 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 49
  • Joined: 01-May 11

Posted 02 January 2013 - 11:34 PM

View Postpompey_pete, on 09 August 2012 - 04:58 AM, said:

Firstly, thanks to markvr for excellent job on this extension!

Secondly, anyone know why twitter might not be working? Facebook works absolutely fine but when I try to use twitter an error stops the app. The error doesn't clear until I wipe the cookies to clear the session.

The error contains the following in stack trace:

–  /home/snowglo/public_html/protected/modules/hybridauth/Hybrid/Storage.php(25): unserialize("O:9:"Exception":7:{s:10:"*message";s:69:"Authentification fail...")


And the top message is:

include(DefaultController.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory


DefaultController.php does exist so I can't explain why that's been reported, but the issue seems to be that twitter auth is failing and, despite double checking the public key and secret, I can't see why...

any ideas?


Did anyone ever figure this out? I see it gets asked several times but I don't see anyone answering it.
1

#109 User is offline   MarkR 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 02-October 12

Posted 08 January 2013 - 01:12 PM

I know it's been designed not to work like this, but I was hoping to use this as an extension of my current user system. I've extended RemoteUserIdentity from my existing identity class, but the session data is not shared between my application and the module.

Is there a simple way to share session data between the module and the main app? I realise this isn't specific to this module but occurs within all modules (as I'm lead to believe).
0

#110 User is offline   vincenze 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 06-December 12

Posted 14 January 2013 - 05:46 PM

Ok, here are my small fixes.

Step by step instructions for connecting to Facebook.
* Download the hybridauth extension.
* Extract it into the directory protected/modules/hybridauth
* Download the code for HybridAuth from http://hybridauth.sourceforge.net
* Extract it and replace the directory protected/modules/hybridauth/Hybrid with the code from hybridauth/Hybrid in it
* In protected/config/main.php add the parameter
'params' => array(
  //the duration of the user login cookie in days
  'authCookieDuration' => 365,
),

* Get your Facebook API ID and secret from http://developers.facebook.com/apps
Click on "Create New App", provide the name, then click on "Website with Facebook Login".
In the field "Site URL:" enter the URL of your website like this:
http:// YOUR_WEBSITE.com/hybridauth/default/callback?hauth.done=Facebook

* In protected/config/main.php add the parameter and paste the API ID and SECRET from Facebook.
'hybridauth' => array(
            'baseUrl' => 'http://' . $_SERVER['SERVER_NAME'] . '/hybridauth', 
            'withYiiUser' => false, // Set to true if using yii-user
            "providers" => array (  

                "Facebook" => array( 
                    "enabled" => true,
                    "keys"    => array ("id" => "FACEBOOK_API_ID", "secret" => "FACEBOOK_API_SECRET"),
                    "scope"   => "email,publish_stream", 
                    "display" => "" 
                ),
),


* Apply my fixes to the code
diff -rupN old/components/RemoteUserIdentity.php new/components/RemoteUserIdentity.php
--- old/components/RemoteUserIdentity.php	2012-07-31 20:13:00.000000000 -0700
+++ new/components/RemoteUserIdentity.php	2013-01-14 14:10:23.256614781 -0800
@@ -38,6 +38,7 @@ class RemoteUserIdentity extends CBaseUs
 		if ($adapter->isUserConnected()) {
 			$this->_adapter = $adapter;
 			$this->loginProviderIdentifier = $this->_adapter->getUserProfile()->identifier;
+                       $this->userData = $this->_adapter->getUserProfile();
 
 			$user = HaLogin::getUser($this->loginProvider, $this->loginProviderIdentifier);
 			
diff -rupN old/controllers/DefaultController.php new/controllers/DefaultController.php
--- old/controllers/DefaultController.php	2012-07-31 20:12:30.000000000 -0700
+++ new/controllers/DefaultController.php	2013-01-14 14:12:59.488615292 -0800
@@ -111,7 +111,12 @@ class DefaultController extends Controll
 	}
 	
 	private function _loginUser($identity) {
-		Yii::app()->user->login($identity, 0);
+               //store the cookie for longer time
+               $duration = 10000;
+               if (isset(Yii::app()->params['authCookieDuration'])) {
+                  $duration = 3600 * 24 * Yii::app()->params['authCookieDuration'];
+               }
+		Yii::app()->user->login($identity, $duration);
 		$this->redirect(Yii::app()->user->returnUrl);
 	}
 
@@ -121,7 +126,13 @@ class DefaultController extends Controll

 	public function actionCallback() {
 		require dirname(__FILE__) . '/../Hybrid/Endpoint.php';
-		Hybrid_Endpoint::process();
+		try {
+		    Hybrid_Endpoint::process();
+		} catch (Exception $e) {
+                   Yii::log("Error user logged using an external provider: " . $e->getMessage());
+	            Yii::app()->user->setFlash('hybridauth-error', "Something went wrong");
+		    $this->redirect(Yii::app()->session['hybridauth-ref'], true);
+		}
 	}
 	
 	public function actionUnlink() {
diff -rupN old/HybridauthModule.php new/HybridauthModule.php
--- old/HybridauthModule.php    2012-07-31 19:09:14.000000000 -0700
+++ new/HybridauthModule.php    2013-01-17 14:29:12.621460767 -0800
@@ -16,10 +16,18 @@ class HybridauthModule extends CWebModul
                $this->setImport(array(
                        'hybridauth.models.*',
                        'hybridauth.components.*',
+                       'hybridauth.controllers.*',
                ));
                require dirname(__FILE__) . '/Hybrid/Auth.php';
-               $this->_hybridAuth = new Hybrid_Auth($this->getConfig());
-       }
+        try {
+            //start the session
+            Yii::app()->session->open();
+            $this->_hybridAuth = new Hybrid_Auth($this->getConfig());
+        }
+        catch (Exception $e) {
+            Yii::log("HybridAuth message: " . $e->getMessage());
+            throw new CHttpException(500, "Error logging in. Did you deny?");
+        }
 
 
        public function beforeControllerAction($controller, $action) {


0

#111 User is offline   glitches 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 26-February 13

Posted 26 February 2013 - 02:00 PM

Hello,

I'm trying to get this module working and having some basic trouble. This is the error I'm getting:

Fatal error: Call to a member function getConfig() on a non-object in /.../applications/site/protected/modules/hybridauth/widgets/renderProviders.php on line 10


I'm trying to get this module working off the basic hello world app. I downloaded Yii version 1.1.13 the hybridauth extension version 1.2.

Here is my config (main.php):
<?php

return array(
	// Autoloading model and component classes
	'import'=>array(
		'application.modules.hybridauth.*'
	),
	
	// Component configuration
	'components' => array(
		'db' => array(
			'connectionString' => 'mysql:host=localhost;dbname=test',
			'username' => 'root',
			'password' => '',
			'emulatePrepare' => true,
			'charset' => 'utf8',
			'tablePrefix' => '',
			'enableProfiling' => true
		),
		
		'urlManager'=>array(
			'urlFormat'=>'path',
			'showScriptName'=>false,
			'rules'=>array()
		),
	),
	
	// Modules
	'modules' => array(
		'hybridauth' => array(
			'baseUrl' => 'http ://' . $_SERVER['SERVER_NAME'] . '/hybridauth',
			'withYiiUser' => false, // Set to true if using yii-user
			'providers' => array (
				'Facebook' => array(
						'enabled' => true,
						'keys'   => array ('id' => '3390...', 'secret' => 'f933...'),
						'scope'   => 'email,publish_stream',
						'display' => ''
				),
			),
		)
	)
);


My controller (controllers/SiteController.php):

<?php

Yii::import('application.modules.hybridauth.controllers.DefaultController');

/**
 * SiteController is the default controller to handle user requests.
 */
class SiteController extends DefaultController {
	
	/**
	 * Index action is the default action in a controller.
	 */
	public function actionIndex() {
		$this->render('test', array('testing'=>'Hello world.'));
	}
}


My view (views/site/test.php):

<?php var_dump($this->widget('application.modules.hybridauth.widgets.renderProviders')); ?>


I extracted the HybridAuth module to protected/modules/hybridauth of course and created the ha_auth table in my testdb.

Trying to load index.php/hybridauth doesn't render other than my standard index page. Any clues?
0

#112 User is offline   bingjie2680 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 56
  • Joined: 08-June 11

Posted 18 March 2013 - 05:01 PM

when I logged in to the facebook, and probably facebook calls back, I got this error:
Authentification failed! Facebook returned an invalide user id.

does anybody have any clue what may be wrong?


update: I found the solution which is to update the facebook sdk under hybridauth thirdparty.
0

#113 User is offline   octavi4 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 31-March 13

Posted 31 March 2013 - 02:37 PM

Can someone help me with my problem.

I make installation process how was described in Install section:
1. Copy unzip files (im copied folder "hybridauth-2.1.2\hybridauth" to "protected\modules")
2. Add the following to the "modules" section in main.php (ok, done)
3. Run the following SQL to create the table to hold the logins. (ok, its was done)
4. You can either then just link people directly to the URL "hybridauth" to login
- And now I have a problem with Step 4.

When trying to going localhost/project/index.php?r=hybridauth I have error:

Alias "hybridauth.HybridauthModule" is invalid. Make sure it points to an existing PHP file and the file is readable.

What should i do to fix this problem? Please help someone.


PS Sorry if it is was hardly to read, my English is not perfect.
0

#114 User is offline   vincenze 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 4
  • Joined: 06-December 12

Posted 03 April 2013 - 05:41 PM

View Postoctavi4, on 31 March 2013 - 02:37 PM, said:


When trying to going localhost/project/index.php?r=hybridauth I have error:

Alias "hybridauth.HybridauthModule" is invalid. Make sure it points to an existing PHP file and the file is readable.



Check that there is a file
protected/modules/hybridauth/HybridauthModule.php
0

#115 User is offline   shiv 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 45
  • Joined: 05-November 11
  • Location:India

Posted 26 April 2013 - 04:18 AM

Here are worm working samples

www.zoomchat.in
www.iseetv.biz
www.bemployable.com

Thanks,
Shiv
0

#116 User is offline   menxaca 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 121
  • Joined: 26-November 12
  • Location:Talavera de la Reina, Spain

Posted 02 June 2013 - 05:01 PM

Hi All,

I'm trying to integrate Paypal into Hybridauth, Paypal use Auth2 as I can see in their documentation here so it should be easy:

Create a new provider file that extends from Hybrid_Provider_Model_OAuth2
Add the configuration and endpoints
Enable the new provider and configure client_id and secret_id

Well, beautiful but... I'm getting this error: 'The Authorization Service has return: invalid_client'

I don't know where this comes from, the client_id and secre_id are correct. This fails before sendiing the token, this is:

the user authorizes and login with his credentials
Paypal sends me back an authorization_code
I send this code in order to get the token

This fail in the third step, exactly in the function 'authenticate'.

Any suggestions are welcome, thanks!
0

#117 User is offline   PrplHaz4 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 108
  • Joined: 28-September 09
  • Location:Boston, MA

Posted 03 June 2013 - 09:52 AM

View Postmenxaca, on 02 June 2013 - 05:01 PM, said:

Hi All,

I'm trying to integrate Paypal into Hybridauth, Paypal use Auth2 as I can see in their documentation here so it should be easy:

Create a new provider file that extends from Hybrid_Provider_Model_OAuth2
Add the configuration and endpoints
Enable the new provider and configure client_id and secret_id

Well, beautiful but... I'm getting this error: 'The Authorization Service has return: invalid_client'

I don't know where this comes from, the client_id and secre_id are correct. This fails before sendiing the token, this is:

the user authorizes and login with his credentials
Paypal sends me back an authorization_code
I send this code in order to get the token

This fail in the third step, exactly in the function 'authenticate'.

Any suggestions are welcome, thanks!


Your best bet for help on developing a provider will probably be on the Hybridauth Support Site: http://hybridauth.so...et/support.html

I'd recommend developing the provider against the vanilla php version of the HA library to eliminate anything that might be caused by Yii. This will also ensure it can be used (and has been tested for) the larger hybridauth community, not just Yii users.

I had developed a Dwolla provider, but it required some changes to the CURL calls, so is not a truly pluggable provider - had to reference the official dwolla php library to identify what parameters were required and what specific headers...etc were needed. That being said, for the OAuth2 portion of the provider, the stock HA library worked fine - it was some of the additional endpoints that required the hacks.
0

#118 User is offline   SEOntist 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 05-February 13

Posted 25 June 2013 - 09:54 AM

Hey all,
I have setup hybrid auth with one single provider - facebook, i have created an app in facebook and copied the appid and uniqueid to the modules section in main.php i keep getting an error -"You haven't supplied a provider".I also followed the setup information on the extension page.

Some input from you guys would be helpful, much appreciated.

Thanks
0

#119 User is offline   menxaca 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 121
  • Joined: 26-November 12
  • Location:Talavera de la Reina, Spain

Posted 26 June 2013 - 12:26 PM

View PostSEOntist, on 25 June 2013 - 09:54 AM, said:

Hey all,
I have setup hybrid auth with one single provider - facebook, i have created an app in facebook and copied the appid and uniqueid to the modules section in main.php i keep getting an error -"You haven't supplied a provider".I also followed the setup information on the extension page.

Some input from you guys would be helpful, much appreciated.

Thanks


Basically you haven't put any provider in the link you have for start the login flow, your link must look something like:
http://domain.com/hy.../default/login/?provider=Twitter
0

#120 User is offline   SEOntist 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 05-February 13

Posted 26 June 2013 - 04:37 PM

View Postmenxaca, on 26 June 2013 - 12:26 PM, said:

Basically you haven't put any provider in the link you have for start the login flow, your link must look something like:



Thanks for your input much appreciated.
0

Share this topic:


  • (7 Pages)
  • +
  • « First
  • 4
  • 5
  • 6
  • 7
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users