sleepwalker / hoauth Goto Github PK
View Code? Open in Web Editor NEWyii-hoauth provides simple integration with social network authorisation lib Hybridauth in Yii.
License: Other
yii-hoauth provides simple integration with social network authorisation lib Hybridauth in Yii.
License: Other
Dear developer,
your extention have issue.
that issue is "error 500 include(loginController)". that issue come to pass when i click deny in G+ or cancel in facebook. so how to fixed ?
Thanks
How do you set the return url before logging into a provider etc.....
Hy,
After installing and setting parameter, I can't login/signin.
Every time I get error like :
2014/09/21 12:38:48 [error] [exception.CException] exception 'CException' with message 'Property "User.email" is not defined.' in website/protected/vendor/framework/base/CComponent.php:130
Stack trace:
#0 website/protected/vendor/framework/db/ar/CActiveRecord.php(145): CComponent->__get('email')
#1 website/protected/extensions/hoauth/HOAuthAction.php(234): CActiveRecord->__get('email')
#2 website/protected/extensions/hoauth/HOAuthAction.php(163): HOAuthAction->getAccessCode()
#3 website/protected/extensions/hoauth/HOAuthAction.php(136): HOAuthAction->oAuth('Live')
#4 website/protected/vendor/framework/web/actions/CAction.php(76): HOAuthAction->run()
#5 website/protected/vendor/framework/web/CController.php(308): CAction->runWithParams(Array)
#6 website/protected/vendor/framework/web/CController.php(286): CController->runAction(Object(HOAuthAction))
#7 website/protected/vendor/framework/web/CController.php(265): CController->runActionWithFilters(Object(HOAuthAction), Array)
#8 website/protected/vendor/framework/web/CWebApplication.php(282): CController->run('oauth')
#9 website/protected/vendor/framework/web/CWebApplication.php(141): CWebApplication->runController('site/oauth')
#10 website/protected/vendor/framework/base/CApplication.php(180): CWebApplication->processRequest()
#11 website/index.php(13): CApplication->run()
#12 {main}
REQUEST_URI=/site/oauth?provider=Live
After some research doing a CVardump to the $user give :
[trace] [application] Test User: User#1
(
[CActiveRecord:_new] => false
[CActiveRecord:_attributes] => array
(
'USER_ID' => '2'
'USERSTATE_ID' => '2'
'USERCLASS_ID' => '3'
'USER_LASTNAME' => 'LASTTest'
'USER_FORNAME' => 'FORTest'
'USER_EMAIL' => '[email protected]'
'USER_PASSWORD' => 'hashedpassword'
)
[CActiveRecord:_related] => array()
[CActiveRecord:_c] => null
[CActiveRecord:_pk] => '2'
[CActiveRecord:_alias] => 't'
[CModel:_errors] => array()
[CModel:_validators] => null
[CModel:_scenario] => 'update'
[CComponent:_e] => null
[CComponent:_m] => null
)
But even using $user->_emailAttribute or $user->USER_EMAIL give a null value making a null identity etc..
All other part of website run, so I don't know why here...
PS: will be good to precise what getId / getName must return in UserIdentity for who don't use yii-user.
My Config:
'oauth' => array(
// the list of additional properties of this action is below
'class' => 'ext.hoauth.HOAuthAction',
'model' => 'User',
// model attribute => profile attribute
'attributes' => array(
'USER_EMAIL' => 'email',
'USER_FORNAME' => 'firstName',
'USER_LASTNAME' => 'lastName',
),
),
System Spec :
PHP 5.4.33
Yii yii-1.1.15.022a51
hoauth 1.2.5
I click the facebook link, but got the following error. Where is User.fname is defined? Did I miss any step during installation?
"Unspecified error.
Original error message: Property "User.fname" is not defined."
after copying all the files and directories in my hoauth directory , i configured my apps by going to the link http://mysite.com/index.php?r=site/oauthadmin . I finished my configuration and when i clicked the login buttons a new window opens with the url http://mysite.com/index.php?r=site/oauth&provider=Google but the window remains blank. Initially it was showing the permission window but now it comes to be blank every time...i reverted all the changes i made to any of the files in the hoauth directory but still nothing changes
I have set-up hoauth and it works great. However I would like to avoid modifying the user module files directly and keep them as a clean git submodule in our project (having external modules that cannot be updated easily sounds dangerous in the long term).
It's easy enough inserting the widget in the view with a theme, but is there any way I can avoid modifying the Login Controller's actions in the module file itself?
$adapterFacebook = UserOAuth::model()->authenticate("Facebook");
$adapterFacebookContacts = $adapterFacebook->getUserContacts();
while logging in with LINKEDIN i am getting this error
Parse error due to improperly structured switch statement - $error is initialized within switch.
This widget will simply aggregate user's social network connections and will display the list of links
<ul class="hoauthSNList">
<li><a href="linkToProfile">Social network</a></li>
...
</ul>
It will be also new column "profile" in db created, where we will cache user's profile object. And of course all widgets should be moved to widgets
directory.
Error page and will show app id and scret code if user press cancel button. It happend in this demo too http://hoauth.hamstercms.com/yii-user/user/login
Hi! i'm test your extension and liked very much! but i have a problems on login. Yii send this message -- Illegal string offset 'php_session_id' -- The error
FILE = hybridauth\Hybrid\Storage.php(30)
public function config($key, $value=null)
26 {
27 $key = strtolower( $key );
28
29 if( $value ){
30 $_SESSION["HA::CONFIG"][$key] = serialize( $value );
31 }
32 elseif( isset( $_SESSION["HA::CONFIG"][$key] ) ){
33 return unserialize( $_SESSION["HA::CONFIG"][$key] );
34 }
35
36 return NULL;
37 }
Just set up a new YII application, with hoath, and yii_user..
I followed all the directions to the letter, and install went fine but when I go to login I am getting a error.
full: http://pastebin.com/f8pWeYif
summary: Trying to get property of non-object
/var/www/gametoken/protected/extensions/hoauth/HOAuthAction.php(178)
URL: /index.php?r=site/oauth&provider=Google
The only provider I sat up was google, and disabled the rest for testing.
New to YII, and hoauth, so it most likely me, but after beating my head against the wall for a day, I decided to spot as a issue.. hope you can help..
Currently, the only ways to associate a social authentication with a user is that
I'm proposing adding a 3rd scenario, where the user is already logged in:
3. user is already logged in, save provider association in user_oauth table for currently logged in user (Yii::app()->user->id, provider, identifier, session)
Hi,
I've managed to integrate hoauth (without Yii-User) my logins for Facebook and Google as SN provider, but it only manages to login if for example http://example.com/index.php/en/user/oauth?provider=google is made in the main window and not in the popup window. So my question is, how do I enable it to login when there is the popup windows for the providers?
First when trying to integrate with facebook I got errors for missing User mode properties:
After I added them to the model and to the DB I got the following error:
Error, while saving User model:
array (
'username' =>
array (
0 => 'Username cannot be blank.',
),
'password' =>
array (
0 => 'Password cannot be blank.',
),
)
What should I do?
Might upload the complete files of this demo
http://hoauth.hamstercms.com/yii-user/
Dear All
The issue is that if the user has already logged in and tried to log in again, then the associated record's user_id in the user_aouth table is set to 0. I guess the user_id is int and the code is trying to put the email address in Yii::app()->user->id there. Then again the Yii::app()->user->id should not have been an email address in the first place.
protected function getAccessCode()
{
$oAuth = $this->oAuth;
// If we already have a user logged in, associate the authenticated
// provider with the logged-in user
if(!Yii::app()->user->isGuest) {
$accessCode = 1;
$oAuth->bindTo(Yii::app()->user->id);
} else {
Please, be advised that hybridauth lib back to live and found new mantainers. At now a lot of fixes applying, and finally it expected to get the new version tag.
Guess you need to prepare new release of hoauth because some fixes are important.
Have a good luck!
Hey guys,
Have anyone had this problem? The thing is that, when you are not connected to your facebook account, when you try to authenticate in your website, it opens the login page of facebook, but when you submit your email/password, it leaves you there in a blank page. It logs in though, because if you try again to click on "Login with Facebook" it will work.
Any ideas?
Having the config file name hardcoded in the extension makes it cumbersome to load a different config depending on environment.
Specifically, using yii-environment extension to manage configs.
One solution would be to allow override of config filename in Yii::app()->params
Found a small bug while debugging my setup...
https://github.com/SleepWalker/hoauth/blob/master/HOAuthAction.php#L358
need to change:
$user->errors
to
$profile->errors
Found this because my test account had a last name of "."
Error thrown after fixed was:
array (
'last_name' =>
array (
0 => 'Last Name is too short (minimum is 3 characters).',
),
)
It would actually be awesome if it could prompt the user to update the field if something like this happens.. but might be pie in the sky...
I didn't find how to add Vkontakte auth.
I have set up hoauth on top of yii-user carefully following the installation guide.
I can login/register with Gmail provider, and display my profile.
However when I try the example in the doc :
$userOAuths = UserOAuth::model()->findUser(5); // find all authorizations from user with id=5
foreach($userOAuths as $userOAuth)
{
$profile = $userOAuth->profile;
echo "Your email is {$profile->email} and social network - {$userOAuth->provider}<br />";
}
I get a "include(UserOAuth.php): failed to open stream: No such file or directory" error.
phpinfo() shows OAuth is enabled on my server.
What am I doing wrong ?
in getUserContacts() method i am getting only 25 contacts. But in my Gmail i have 470 contacts... can i know where is the main problem....
Probably we should change authentication framework (for example to this), because HybridAuth is not maintained...
Scenario:
Let's say user has 2 gmail accounts [email protected] and [email protected]
First he logs on the site. It will create the user normally . It logs out and logs back in with the second gmail account . While logged send time on [email protected] time puts on user email [email protected] when creating the account.
( i think it can be reproduced by having 2 facebook accounts as well )
It will generate the following error:
"Original error message: CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-Google' for key 'unic_user_id_name'. The SQL statement executed was: INSERT INTO tbl_user_oauth
(provider
, profile_cache
, identifier
, session_data
, user_id
) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4)"
public function bindTo($user_id)
{
$this->user_id = $user_id;
return $this->save();
}
При установке https://github.com/SleepWalker/hoauth-demo-site через composer как написано в инструкции возникают ошибки такие как You forgot to bind 'email' field in HOAuthAction::attributes property.
Is it possible to set certain fields (like timezone, country, etc.) to related User model before hoauth saves User data? For example, when user registers using Facebook account, application could retrieve various data from his Facebook account and save it to User model.
If it is possible, where should we place the code? I saw we only have 2 callbacks (i.e. hoauthAfterLogin and hoauthCheckAccess) and User model has been created when they are called.
Hi,
I am trying to integrate hoauth with humhun but the Yii::app()->user->isGuest is always true. How to fix this?
I followed the steps for installation but I am not able to make user login using FB.
Regards
Pvnarula
This will allow simple installation outside of my application's path. Let me know if you need a sample composer.json and I will do a pull request.
Hi....I'm trying to integrate this extension in my customised Yii application on localhost (Windows 7 and XAMPP). When I invoke the login form of my application, I get the CException error "The config.php file doesn't exists". Can you pls help me?
#4. Visit your oauthadmin action (eg. http://yoursite.com/site/oauthadmin) to create the HybridAuth config. For your HybridAuth Endpoint URL use this: http://yoursite.com/site/oauth. After install you can leave install.php in your file system, while it's in Yii protected directory. But you must remove oauthadmin action, or make such rules, that give access only for admin users. Config file can be found at application.config.hoauth
Then you are facing following error:
"Trying to get property of non-object"
HOAuthAction.php line 178
It seems that exception #5 is not handled. My current fix is the following:
Change in UserOAuth.php at line 215:
catch( Exception $e )
{
$error = "";
switch( $e->getCode() )
{
case 6 : //$error = "User profile request failed. Most likely the user is not connected to the provider and he should to authenticate again.";
case 7 : //$error = "User not connected to the provider.";
$this->logout();
return $this->authenticate($provider);
break;
}
}
into
catch( Exception $e )
{
$error = "";
switch( $e->getCode() )
{
default:
$this->logout();
throw $e;
break;
case 6 : //$error = "User profile request failed. Most likely the user is not connected to the provider and he should to authenticate again.";
case 7 : //$error = "User not connected to the provider.";
$this->logout();
return $this->authenticate($provider);
break;
}
}
But i'm doubting of myself, this issue seems too obvious...
Solution with email:
Hybrid_Auth::storage()->set( "hauth_session.{$this->providerId}.email", $response->email );
Hello, Facebook contact me saying my app is making calls to v1.0 of the Graph API which will be deprecated, do you know how to avoid this version issue?
Thank you.
Hi @SleepWalker,
Thank you for Awesome work!
I have installed hoauth with yii-user extensions, and everything seems working fine. In hoauth config file i have set configuration something like below
return array( "base_url" => "http://dev.localhost.com/user/login/oauth", "providers" => array ( "Facebook" => array ( "enabled" => true, "keys" => array ( "id" => "FOO", "secret" => "FOO" ), "display" => "popup" ), ), )
Here is just a sample config for Facebook.
What my problem is, when i click on facebook login button, it shows me a pop up and then i am entering my fb login credential and after successfully login in FB it is not taking me back to parent window but instead of that it shows me website in pop up itself. So logically it should take me to the website and over there i can select username & email id.
I am not sure how to do this? if you have such config setting then please let me know.
or else i have to make changes widget code.
many thanks in advance!
I saw hoauth has it's own database "user_oauth"
I'm wondering how it can connect with yii-user if their table are different. If I'm taking user ID from yii-user table, I guess it's not the same as one from "user_oauth"
From what I see in the code the hoauthProcessUser
hasn't the user profile in its params but if the user is new or not.
On the other side the processUser
has the profile as a param.
if($this->alwaysCheckPass || $user->isNewRecord)
if(method_exists($this->controller, 'hoauthProcessUser'))
$user = $this->controller->hoauthProcessUser($user, $newUser);
else
$user = $this->processUser($user, $userProfile);
Wouldn't be better if hoauthProcessUser
also had profile informations?
The main issue is that if we add a param to the callback it will break compatibility with older implemented callbacks.
When CSRF is enabled on the site the installation process fail.
I think that the CSRF token is not send along with the other data in the POST request.
But since the installation file is from Hybrid Auth, the issue is not really easy to solve ...
Hello,
I'm having a problem with facebook connect with hoauth and yii-user installed;
I try to create a new authenticated user by using facebook connection. When I click on facebook button , the facebook login is open and when I login to facebook, I am redirected to the admin profile !!
Any idea ?
When you sign up using Facebook and use a existing email address it will ask you to change the email address or enter password.
If you change the email address it will allow you access to the existing account when it should create a new one.
When mew users log in with Facebook, they must enter a username before completing their registration with the website. The username field is prepopulated with their Facebook name, which contains a space (e.g. "John Smith"). But usernames cannot contain spaces, which causes an error if they try to save the prepopulated username. That's not a great user experience. This may be because I'm using Yii-User, which has it's own set of rules for usernames. Would be great if hoauth could replace spaces with underscores, or remove them, or take some other action to make it easier for users to create a new account.
table name is hardcoded, and should be
/**
* @return string the associated database table name
*/
public function tableName()
{
return '{{user_oauth}}';
}
but this will break the table renaming hack, which should exist as a migration, not in the model script (IMO).
I have a migration for the table creation, but not one that will update it between the two existing versions (if you would like it).
I'm triyng to set the return url before logging into a provider. I read the Issue #20 but in HoAuthAction.php in which part of code I put the line?
hai,
I need the contacts of a particular user so i think getUserContacts() method is helpful to get the contacts can any one help me on how to call this method from a controller .
thanks in advance....
Can we display a form after user logs in to his social network account? So before application saves data to User table, it will ask user to accept Terms/Policy and fill certain fields that cannot be retrieved from his social network account.
As mentioned in issue #38, it seems we can use hoauthProcessUser($user, $userProfile)
callback. However, I'm still not sure how to use it to display form and what code that needs to be copied from HOAuthAction::processUser()
method.
'attributes' => array(
'email' => 'email',
'name' => 'firstName',
'lastName' => 'lastName',
'gen' => 'genderShort',
'birthDate' => 'birthDate',
'activationstatus' => 1,
'username'=>'displayName',
_____________________
'country'=>'country',
'city'=>'city',
____________________
in my database the fileds country and city return null, how I add more attributes
How do I update a user's status? For example, updating a logged-in (connected) Facebook user's status.
For example, with hybridauth, I do this:
$adapter = $hybridauth->authenticate( $provider );
$adapter->setUserStatus($message);
But how can I do that using this library?
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.