[MODULE] HybridAuth
#101
Posted 20 December 2012 - 11:16 PM
I've got too many errors, that i don't know where to start.
#102
Posted 25 December 2012 - 10:12 AM
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
#103
Posted 25 December 2012 - 10:58 AM
zerolimit, on 20 December 2012 - 11:16 PM, said:
I've got too many errors, that i don't know where to start.
Go to http://www.yiiframew...ion/hybridauth/ and follow steps....
#104
Posted 25 December 2012 - 08:46 PM
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?
#105
Posted 28 December 2012 - 12:35 PM
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!
#106
Posted 29 December 2012 - 12:37 PM
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
#107
Posted 29 December 2012 - 03:23 PM
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.
#108
Posted 02 January 2013 - 11:34 PM
pompey_pete, on 09 August 2012 - 04:58 AM, said:
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.
#109
Posted 08 January 2013 - 01:12 PM
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).
#110
Posted 14 January 2013 - 05:46 PM
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) {
#111
Posted 26 February 2013 - 02:00 PM
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?
#112
Posted 18 March 2013 - 05:01 PM
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.
#113
Posted 31 March 2013 - 02:37 PM
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.
#114
Posted 03 April 2013 - 05:41 PM
octavi4, 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
#115
Posted 26 April 2013 - 04:18 AM
www.zoomchat.in
www.iseetv.biz
www.bemployable.com
Thanks,
Shiv

Help












