Hello everyone!
I’m trying to implement modules like Yiiauth or HybridAuth for facebook login.
First I have registered my app on https://developers.facebook.com/ to receive a key and a secret, so finally I’ve got this
![: facebookApp.png]()
Second I’ve implemented this one for rbac.
And here is my xeom_user table:
Here are my steps trying to implement each module.
1.Yiiauth.
-Download module from this link
-Put hybridauth folder in my root folder (where bootstrap file index.php is located)
-Put login_icons to my root/images folder.
-Import /yiiauth/social.sql to my database.
-Change prefix tbl to xeom for my need.
-Put yiiauth folder in protected/modules.
-change the code of controller.php from protected/components to something like this
-add the following code to modules section ind protected/config/main.php
-Put the following code to my site/loginFB view.
After running www.aloxeom/site/loginFB I got this error
From the post the module’s author writes:
So I think I haven’t connected my xeom_user table with the provider user yet. And that is the issue.
2.HybridAuth
-Unzip into protected\modules\ so I got protected\modules\hybridauth
-Add the following to the "modules" section in main.php:
-Run the following SQL to create the table to hold the logins.
-Put the following code to site/loginFB view.
After runing this view I’ve got this
![: hybridauth.png]()
I think the reason of this is not connecting my xeom_user table with the provider user.
Could anybody give me a good correction so I can get the modules working?
Any suggestion would be appreciated.
Thank you for your time.
I’m trying to implement modules like Yiiauth or HybridAuth for facebook login.
First I have registered my app on https://developers.facebook.com/ to receive a key and a secret, so finally I’ve got this
Second I’ve implemented this one for rbac.
And here is my xeom_user table:
CREATE TABLE IF NOT EXISTS `xeom_user` ( `user_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `user_name` varchar(60) NOT NULL COMMENT 'The username is use to login to the website', `user_password` varchar(60) NOT NULL, `user_email` varchar(60) NOT NULL COMMENT 'The user\\''s email might be used to send the reset password or other information such as: order information.', `user_role` varchar(10) DEFAULT 'member' COMMENT 'Specifies role of user as: unauthenticated user, member (authenticated), admin', PRIMARY KEY (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Identifies a user ';
Here are my steps trying to implement each module.
1.Yiiauth.
-Download module from this link
-Put hybridauth folder in my root folder (where bootstrap file index.php is located)
-Put login_icons to my root/images folder.
-Import /yiiauth/social.sql to my database.
-Change prefix tbl to xeom for my need.
-Put yiiauth folder in protected/modules.
-change the code of controller.php from protected/components to something like this
<?php class Controller extends Yiiauth{...?>-add the following code to modules section ind protected/config/main.php
'yiiauth'=>array(
'userClass'=>'User', //the name of your Userclass
'config'=>array(
"base_url" => "http://aloxeom.vn/hybridauth/",
"providers" => array (
"Facebook" => array (
"enabled" => true,
"keys" => array ( "id" => "myid", "secret" => "mysecret" ),
"scope" => "",
"display" => "page"
),
),
"debug_mode" => false,
"debug_file" => "",
),
)
-Put the following code to my site/loginFB view.
<?php $this->widget('LoginWidget');?>After running www.aloxeom/site/loginFB I got this error
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /home/aloxeom/public_html/protected/modules/yiiauth/components/Yiiauth.php on line 31
From the post the module’s author writes:
Quote
I haven't added a full user system to this module because I believe most wants to solve this their own way.
But it includes code to create a yii-user,connect them with the provider user etc.
But it includes code to create a yii-user,connect them with the provider user etc.
So I think I haven’t connected my xeom_user table with the provider user yet. And that is the issue.
2.HybridAuth
-Unzip into protected\modules\ so I got protected\modules\hybridauth
-Add the following to the "modules" section in main.php:
'hybridauth' => array(
//'baseUrl' => 'http://'. $_SERVER['SERVER_NAME'] . '/hybridauth',
'baseUrl' => 'http://'. $_SERVER['SERVER_NAME'] .'/hybridauth',
'withYiiUser' => false, // 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"
),
)
),-Run the following SQL to create the table to hold the logins.
CREATE TABLE IF NOT EXISTS `ha_logins` ( `id` int(11) NOT NULL AUTO_INCREMENT, `userId` int(11) NOT NULL, `loginProvider` varchar(50) NOT NULL, `loginProviderIdentifier` varchar(100) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `loginProvider_2` (`loginProvider`,`loginProviderIdentifier`), KEY `loginProvider` (`loginProvider`), KEY `loginProviderIdentifier` (`loginProviderIdentifier`), KEY `userId` (`userId`), KEY `id` (`id`) ) ENGINE=InnoDB
-Put the following code to site/loginFB view.
<?php $this->widget('application.modules.hybridauth.widgets.renderProviders'); ?>After runing this view I’ve got this
I think the reason of this is not connecting my xeom_user table with the provider user.
Could anybody give me a good correction so I can get the modules working?
Any suggestion would be appreciated.
Thank you for your time.