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.
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.
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
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?
Hi,
Any ideas or clues what is the best way to integrate Hybridauth module into Yii user management extension?
http://www.yiiframework.com/extension/yii-user-management/
Any help will be much appreciated!
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:
'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
),
)
),
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
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.
Did anyone ever figure this out? I see it gets asked several times but I don’t see anyone answering it.
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).
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,
),
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
'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" => ""
),
),
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) {
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?
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.
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 [u]problem with Step 4[/u].
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.
Check that there is a file
protected/modules/hybridauth/HybridauthModule.php
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.sourceforge.net/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.
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/hybridauth/default/login/?provider=Twitter
Thanks for your input much appreciated.