- Demo
- Requirements
- Available social networks
- Documentation
- Sources
- New in hoauth v1.2.5
- New in hoauth v1.2.4
- New in hoauth v1.2.3
- New in hoauth v1.2.2
- New in hoauth v1.2.1
- New in hoauth v1.2
- hoauth extension provides simple integration with social network authorization lib Hybridauth in Yii. (facebook, google, twitter, vkontakte and much more).
- Automatically finds and supports
yii-user
module (instruction is in documentation section). - Supports I18N (available translations)
Demo ¶
The demonstration of hoauth
extension integrated with yii-user
extension can be found here.
Requirements ¶
- Yii 1.1.9 or above. (I have tested it only in 1.1.13)
Available social networks ¶
- OpenID
- Yahoo
- MySpace
- Windows Live
- Foursquare
- Vkontakte
- AOL
Additional social networks providers can be found at HybridAuth website. And how to configure them here at the bottom of the page.
Documentation ¶
- Project page and Installation guide
yii-user
installation guide- Creating yii app with
yii-user
andhoauth
from scratch by Serge Ponomaryov (@begemotik on yii's site) - The source code of demo project
UserIdentity
class example- Available Callbacks
Sources ¶
New in hoauth v1.2.5 ¶
- added an option to display only icons in social login widget (HOAuth::onlyIcons)
- Authentication through pop-up window
- Added support of CWebUser::returnUrl (for popup window only if it has not default value)
- Enh#45: Added composer support (example of installation)
- Small refactoring
- Added repo with the source code of demo project.
New in hoauth v1.2.4 ¶
- updated hybridauth lib
- support of older version of yii-user
- moved to MIT license
New in hoauth v1.2.3 ¶
- yii-user: we display
username
field only if it is required by theUser
model, so you can disableusername
field inyii-user
. - fixed bug when after saving profileCache returned in serialized form
- removed some NOTICE erros and fixed one stupid big with email sending callback (thanks to Komannder)
- fixed bug with imposibility of login with twitter (and other similar SN) despite successful email activation
- added two callbacks: hoauthCheckAccess() and hoauthAfterLogin(). Details at https://github.com/SleepWalker/hoauth/wiki/Callbacks.
- added Spanish, German and Russian translations (thanks to Komannder and me)
- Security improvement: if user try to login with email of existing local account, that is not bond to current social network, he will be asked for password to confirm binding.
- added support of validatePassword() callback - alias for verifyPassword()
- added widget HOAuthActive - display login buttons of social networks bond to current user (Komannder)
New in hoauth v1.2.2 ¶
- Enh#6: support of prefixed table names
- Enh#7: added ability to setup alias (by default is application.config.hoauth) of HybridAuth config file in yii config (Yii::app()->params['hoauth']['configAlias'])
- Enh#8: widget to display social networks that user bond to
- Support of
yii-user
version, when Profile::regMode isn't static property - Fixed issue when password field apeared, when it should not do so during social network signup
- Support of sending activation email by
yii-user
module - Added support of
yii-user
banned and not activated account status - Ability to register a new account with the same SN, when in db still exists SN relation to account that was deleted
- HOAuthWidget moved to widgets directory (see UPGRADE.md)
New in hoauth v1.2.1 ¶
- It was decieded to move
HybridAuth
config file to the yii's config diretory and rename tohoauth.php
. Extension will try to do it automatically, when config diretory is not writable, it will run with config file from old directory, but old directory has the deprecated status. - fixed bug with to long username, when registering user for
yii-user
extension. - Support of login from social networks, that returning no email (also added
HUserInfoForm
class). - updates in installation instructions
New in hoauth v1.2 ¶
- HOAuthWiget property
$controllerId
replaced by$route
and now you can specify route e.g. module/controller - Modification of HybridAuth install script to generating
Endpoint URL
properly. - Renaming of
user_oauth
table columns:name
->provider
,value
->identifier
(model will automatically update schema) - New features in
UserOAuth.php
model. - Support for
yii-user
extension
one more !
This is probably an interesting module but what is the difference between this one and others ? I already found 2 hybridAuth modules for yii :
I'm a bit lost here ....
History about one more
@Raoul,
Before I wrote this extension, I have tried to find the ready one. I have found hybridAuth and yiiAuth (and more of them, not only those, that based on
HybridAuth
), but on my opinion they was to complicated. I wanted something like behavior, that I can simply plug in into my project.HybridAuth
is a good lib, it is usable without wrapping).So I decided to make this authorization work by myself and then I have converted it to extension and posted here, while I think it can be useful for someone else. I don't think, that my approach is the best one. Especially I am not sure about
UserIdentity
authentication, but it runs even without class editing. If someone need to add user States, than he can modify construct method:class UserIdentity extends CUserIdentity { /** * @var User $user модель пользователя, полученная по его емейлу */ public $user; public function __construct($username,$password=null) { parent::__construct($username,$password); $this->user = User::findByEmail($this->username); if($password === null) { $this->errorCode=self::ERROR_NONE; $this->setState('someState', 'Hello World'); } } ... }
good
Thanks for your clear reply SleepWalker, I'll try your module in the future...
Integration with yii-user
It is possible to integrate this extension with yii-user?
Integration with yii-user
kernel32ddl, it will be possible soon.
good
Will give it a try. I have tried the existing once but I have too much issues.
support of yii-user
The new version with
yii-user
extension support is out :)About installation you can read in the wiki article.
I hope, that I have noticed all possible bugs.
Problems
This extension with yii-user only work if someone had been registered before, and than try to use Google, Facebook or some other provider Login, but when new user come to website and try to use Login with Google, than it is not possible, record in table 'users' after Allowed permissions are not exist, and there is no automated registration with successful login.
I try with Google, Facebook, LinkeIn and Twitter provider and with Twitter I got errors.
Can someone please upload Demo APP with successful integrated yii-user with this extension with Google, Facebook, LinkedIn and Twitter provider.
Twitter problem
BUG in ./hybridauth/Hybrid/Providers/Twitter.php in line 22 shold be:
$this->api->authorize_url = "https://api.twitter.com/oauth/authorize";
not
$this->api->authorize_url = "https://api.twitter.com/oauth/authenticate";
Webkit problem
In Firefox and Internet explorer, everything works perfect, but in Webkit browsers (Chrome and Safari) I got message "You cannot access this page directly." because of some session handler in ./hybridauth/Hybrid/Endpoint.php
@stepanic
HOAuthAction.php
changing this:$user->username = preg_replace('/[^A-Za-z0-9_]/u', '', $user->email);
to this:
$user->username = substr(preg_replace('/[^A-Za-z0-9_]/u', '', $user->email), 0, 20);
But another problem is that twitter doesn't returns user email. So my algorithm will not work, because it's depends from email. I will fix this issue today or tomorrow and post about this here.
Updates
So, I think, that I fixed bug and added support of Twitter and other social networks, that return no email with user profile.
But I have no time to test it, beacuase I will drive to my homeland in 5 hours. You can watch it here and I go to pack my stuff.
When you happy with current functionality, you can download current version of extension from dev branch
Small bug
Greetings,
thanks for the implementation!
One remark:
in the file UserOAuth.php you put require instead of require_once - it causes fatal error since class was already defined and it tries to include it twice (in case 2+ networks are linked and it lazy loads profile 2+ times).
It is on the line 108 - it should be require_once($path.'/Hybrid/Auth.php');
instead of
require($path.'/Hybrid/Auth.php');
Thanks, Dino
Thanks, Dino, I will include this in next release
UserIdentity Wrong?
Hey I am trying to setup this extension but I am getting an error after
I authenticate with facebook:
Unspecified error.
Original error message: Can't sign in, something wrong with UserIdentity class.
Any Idea how to fix this?
Thanks in advance.
Seb
@sebako
sebako, do you use it with
yii-user
or not? Can I see UserIdentity class?You can create an issue here
Or send me email (see profile)
UserIdentity with email
Hey Friends,
SleepWalker was so kind to assist me via email with this UserIdentity Issue I had, no it came out that I was missing something crucial for hoauth. However here's the new UserIdentity Class:
<?php /** * UserIdentity represents the data needed to identity a user. * It contains the authentication method that checks if the provided * data can identity the user. */ class UserIdentity extends CUserIdentity { /** * @var EUser $user user model that we will get by email */ public $user; private $_pwGuess; public function __construct($username,$password=null) { parent::__construct($username,$password); $this->user = EUser::model()->find('LOWER(email)=?',array(strtolower($this->username))); if($password === null) { $this->setState("userId", $user->id); $this->errorCode=self::ERROR_NONE; }else $this->_pwGuess = $password; } /** * Authenticates a user. * @return boolean whether authentication succeeds. */ public function authenticate() { if($this->user===null) $this->errorCode=self::ERROR_USERNAME_INVALID; elseif($this->user->password !== hash("sha512", $this->_pwGuess)){ $this->errorCode=self::ERROR_PASSWORD_INVALID;} else { $this->setState("userId", $user->id); $this->errorCode=self::ERROR_NONE; } return $this->errorCode==self::ERROR_NONE; } public function getName() { return $this->user->email; } public function getId() { return $this->user->id; } }
I have made some modifications to it so that it fits my application but should work for almost any other application using Emailadress for login.
Thanks again for the Support!
Best,
Seb
Error at offset 0 of 1 bytes
after following above steps it gives
unserialize() [function.unserialize]: Error at offset 0 of 1 bytes ,
Please help me!!,
thnks
New version of hoauth
Hello, fburhan89, try to download the new version 1.2.2 (I have just uploaded it).
But probably this won't help you. The only place, where function
unserialize
in v1.2.1 was used is/hybridauth/Hybrid/Storage.php
. Probably it is something with session in your app. I can't say more with that information that you have posted to me...HOAuth + yii-user reports a 500 error
I have a fresh new installation of Yii 1.13
Then I installed step by step the Yii-User extension 0.8 (http://www.yiiframework.com/extension/yii-user-management)
Then I followed the steps of this to get HOauth working with that extension:
https://github.com/SleepWalker/hoauth/wiki/[install]-hoauth-and-yii-user-extension
Then I go to {mysite}/user/login and I see the hoauth social buttons ... but when I click in one of them:
Error 500
include(SiteController.php): failed to open stream: No such file or directory
Why is that ? :(
Thank you in advance
P.D. I have also tried with Yii-user 0.3.61 from http://www.yiiframework.com/extension/yii-user
@jurassic82
Hi, jurassic82, try this one yii-user
Not working yet
Thank you SleepWalker, but as I told in the P.S of my previous post, I have also tried with Yii-user 0.3.61 from http://www.yiiframework.com/extension/yii-user
Exactly the SAME problem.
@jurassic82
I have posted you link to the github(!) page of extension. Because on yii site the last upload of files was "Last updated: Jun 11, 2012" and on GitHub 18 days ago.
I have just downloaded the last code from
yii-user
GitHub page and installed it to the demo page. And it's works perfectly, as two month old version. But one year old version probably not...So try to use version from github and don't forget to clear db from old
yii-user
's tables, because it can cause another one bug :).When it won't help you. Than probably this is something wrong in your application's config.
hoauth
has nothing to do withSiteController
, when you don't ask it for that. You can send me email with youruser
folder, andconfig.php
(but don't forget to clear passwords etc.) and we will try to get rid of this.P.S. My email you can find here.
thank you !
Thank you SleepWalker
As you suggested I did the complete process but downloading the github last master commit (from yii, yii-user and your extension).
And now it's working ... :-)
Thank you again !!!
Email uniqueness
Great extension, got it working perfectly!
One question though about email uniqueness.
In my apps I use email/password for logins, NOT usernames!!!
Before installing this extension, I customized UserIdentity and just added to the User's email field the 'unique' validator, on all my scenarios (registration, update, public profile).
The question is: how should handle emails now, as they can conflict with hoauth created accounts?
If I do in my User model:
$rulesArray = array(
array('email', 'unique', 'on'=>'registration'),
Users can register with new unique emails, but they will not be able to register if they first entered via facebook with same email.
...
Or what happens when a user that was created via hoauth, goes to his profile (on mi site) and tries to change the email to another existing user?
...
There are many other combinations that can cause problems....
Does anyone have any idea how to handle this mess???
Hi, komannder
I have planned so that account, created by social network authorization was the same, as when user registered "by hand" on site. So this is not like on other sites this usually done.
But after user has registered through
hoauth
he can set new password (when you let him) and then login with his email and password too.Also he can change his email, but his account will be still linked to social network.
When user changes email to another existing email, you should by yourself control this and decide to let him or not.
hoauth
linked to user id, so if user overrides another user, he will still have his past social networks connected (of coarse if you won't change his id).And at last he can bind other social network to his account. To do that, he should use
hoauth
authentication widget, while he is logged in (you can check this feature on test site, to see how its works).P.S. there is one newer version of extension on github. I haven't done all, that I am planing for next release, thats why I haven't posted it here. But you can download its intermediate implementation from github. I have fixed some bugs there.
Thanks SleepWalker
I did get the new git version, fixed a few issues I had, thanks.
I the end I decided to allow changing the email and passwords, and have made the email field unique again.
Everything seems to work great. Once linked by 'id' you can login either way, and you cannot change your email and 'take over' another account.
Thanks for all!
Getting NULL in $_REQUEST['signed_request']
Hi,
Im getting a NULL in $_REQUEST['signed_request'], line 492 of /hoauth/hybridauth/Hybrid/thirdparty/Facebook/base_facebook.php. Anyone know why this could be happening?
Thanks
Hello. felizardo
And when you try to login here. Do you have this error? When not, than it is probably something with your server/php configuration.
I have no idea about why you have this issue. I can't say that this is something with HybridAuth lib, because it is works great (and not only by me). When you won't find the answer, you can try to send me email.
vkontakte support
How to activate vkontakte authorization?
It does not work "from a box".
@akimvital
I have included Vkontakte provider into available Hybridauth providers, but, yes, you can't set up it using configuration skript. You should manually add new element to 'providers' array in hybridauth config file (application.config.hoauth).
So you need to add the folowing lines in your config file:
... "providers" => array ( ... "Vkontakte" => array ( "enabled" => false, "keys" => array ( "id" => "", "secret" => "" ) ), ... ), ...
id
andsecret
keys you will become after registration of your app (choose "Веб-сайт" option).Best Regards
yii-user error
http://prntscr.com/1diu7v - screenshot from hoauth.hamstercms.com when you confirmed your email
I got the same error in my app - but on line 58
and when you using yii-user you don't take a new record in table {{profiles}}
any suggestions?
@krasavcheg.ua
That error from screenshot is bug of yii-user:
https://github.com/mishamx/yii-user/issues/40
Here is quote of this error, if someone will look for solution:
> Fatal error: Call to a member function getAttributes() on a non-object in ...../protected/modules/user/components/WebUser.php on line 57
I have made pull request with my bug fix. You can apply this fix manually, while I don't know when it will be accepted on github.
Update User Facebook status
Any documentation on how to post to a users facbook page
Hi, swampone
This extension was designed firstly only to provide simple authentication. But HybridAuth lib, on which is based this ext can do much more. So you should read it's documentation or watch some demos (see the last demo), where you can find examples how to implement this. You can get access to Hybridauth object and provider object from
UserOAuth
model.Facebook nickname
When a user registers with facebook, they are taken to the form where they enter a nickname and a email. The users full name is entered into the nickname field. How can I stop the full name loading? Maybe make it blank. I believe its causing some confusion during sign up. Because users see the field has there name in it, but when they click submit an error is triggered by the space in there name. Thus halting registration.
@swampone
you can change validation rules of
username
inUser
model.or make this field not required and than delete 125 line in
HOAuthAction
:'username' => 'displayName',
In future releases I will make this process easier :)
please help me on adding new fields
i want to add some more fields to the model in the page where it asks for nickname and email for completing the registration(after logged in with the linkedin).I am not able to understand what is actually happening & i did not understand the model and form pages. please some one show me how can i add some more fields(textfield,radiobuttons etc.,). A very very big thank you in advance.
French Translation
Write to file [ext]/hoauth/messages/fr/root.php
<?php return array ( 'Email' => 'Email', 'Nickname' => 'Pseudo', 'Password' => 'Mot de passe', 'Sorry, but password is incorrect' => 'Désolé, mais le mot de passe est incorrect', 'Submit' => 'Envoyer', 'This {attribute} is taken by another user. If this is your account, enter password in field below or change {attribute} and leave password blank.' => 'Ce {attribute} est pris par un autre utilisateur. S\'il s\'agit de votre compte, entrez le mot de passe dans le champ ci-dessous ou changer le {attribute} et laisser le mot de passe vierge.', 'Please specify your nickname and email to end with registration.' => 'S\'il vous plaît préciser votre pseudo et email pour terminer l\'inscription.', 'Please specify your nickname to end with registration.' => 'S\'il vous plaît préciser votre pseudo pour terminer l\'inscription.', 'Please specify your email to end with registration.' => 'S\'il vous plaît préciser votre email pour terminer l\'inscription.', 'Sorry, but your account' => 'Désolé, mais votre compte', 'must be activated! Check your email for details!' => 'doit être activée! Vérifiez votre email pour plus de détails!', 'is banned!' => 'est banni', 'Return to main page' => 'Retour à l\'accueil', 'Return to login page' => 'Retour à la page de connexion', );
I hate this titles
@FredT69, thanks I have updated
hoauth
on github.@ferozfirru, unfortunately I have not implemented this feature yet... But I will work on this, but in the moment I have no time to do that, sorry. Now you can only make required fields unrequired and ask user after registration by yourself.
P.S. you can use
scenario
property ofHOAuthAction
to specify scenario name for User model.login session timeout problem :?
Hi, i logged in with the linkedin provider and after sometime i logged out. Now whenever iam clicking the linkedin login button on login page its automatically logging in.I think the session timeout is not happening. same thing is happening even if i do this after some days. i have to manually clearing the browser cache to remove the session. bcz anyone who operate my system can easily logging into my account.(sorry for BaD english :D)
non-logged FB user, infinite loop redirect / blank page on yii app
Hey guys, SleepWalker, I've been using this ext on a project for about two weeks..
but I noticed a bug recently, I thought it was misconfiguration on my implementation but then saw the same behavior on your demo
the problem is when the user, tries to user "login with facebook button" without being logged in on FB itself.
So facebook will ask for user / pass on their side.. and then return to the yii app..
processed by oauth / H.A... but seems like some vars are empty or something, I've been debugging and checking the "storage". and the callback url is blank in this particular case.
I wonder if anyone else is getting this issue.. or am I doing something wrong?
INFO -- 127.0.0.1 -- 2013-08-31T16:36:59-03:00 -- Enter Hybrid_Auth::redirect( , PHP )
Get data from oauth_user table
How do I get the 'provider' and 'identifier' data from oauth_user table? Should I specify a relationship from my user table to user_oauth table?
Thanks.
comment
@Oliver Cera, I will try to reproduce this behavior by myself in the next few days. Sorry, that I haven't answered for a long time.
@nat3863, it's depends on what exactly are you trying to do. You can use the
UserOAuth
model for this purpose example. If you want to get Social network Profile you can useUserOAuth::profile
propertyComment
@SleepWalker: I'd like to get the 'provider' data to handle each user differently depending on the user's provider. For example; I'd like to place a badge next to the username to show if a user is a facebook user or a twitter user.
I have tried the UserOAuth Model example but it throws me an error.
include(UserOAuth.php): failed to open stream: No such file or directory
@nat386
For this purpose you can for example add the model to Yii path. In your
config.php
file add'ext.hoauth.models.UserOAuth'
into import array:... // autoloading model and component classes 'import'=>array( 'application.models.*', 'application.components.*', ... 'ext.hoauth.models.UserOAuth', ), ...
and than you can use this model in any place in your code without any
include()
.Another one solution is to use
Yii::import()
instead ofinclude()
:Yii::import('ext.hoauth.models.UserOAuth');
and than you can use for example the following code in your controller:
$userOAuths = UserOAuth::model()->findUser(Yii::app()->user->id); $userBages = array(); foreach($userOAuths as $userOAuth) { $userBages[] = $userOAuth->provider; } $this->render('foo', array( 'bages' => $userBages, ... ));
@SleepWalker
@SleepWalker: Thanks!
Concatenate first name and last name
Hi, How do I concatenate first name and last name social profile fields?
@nat3863
This depends of what are you trying to do. You can try to use
displayName
field of profile object or you can add new field by adding a new case inHOAuthAction::populateModel()
(this method is called, when authentication is in progress)Error on 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) { $key = strtolower( $key ); if( $value ){ $SESSION["HA::CONFIG"][$key] = serialize( $value ); } elseif( isset( $SESSION["HA::CONFIG"][$key] ) ){ return unserialize( $_SESSION["HA::CONFIG"][$key] ); } return NULL; }
@Vinny.freire
You closed the issue on github. Does it mean that problem was solved?
Unable to Login
I am having problem to login with facebook. I am using yii-user with hoauth. when I login i get an error message "You cannot access this page directly"
If I were to comment the error message in the Endpoint.php i get
include(Hybrid_logger.php)[function.include]:failed to open stream: No such file or directory
Can you help me on this? Thanks a lot.
problem fixed
the problem is solved, it's only the provided facebook app developer wrong url configuration.
Problem with logout and new login
Hi, this is my situation:
The first time users are correctly registered, but after they are no longer able to connect again.
How can I fix it?
Thanks in advance for the help
@andreapavan
I think, that the error may be in
User::findByEmail()
method. Because this method is used to determine whether we to register somebody or not. But when this extension says after that there is the user already registered. It also can be an error when hoauth writes user oauth login data into db table. Please check the contents ofuser_oauth
table. Is there any data inside?@SleepWalker
Thanks for your response. In user_oauth and User db everything is saved correctly. I also noticed that does not appear the screen to accept the terms of the app.
Is it possibile to have the code of the example in the description?
User with same email
Hi, I'm not sure if this is a bug or something. I have tried this on my development, basically, I have 2 users from 2 different providers; facebook and twitter. However, both user shares the same email address.
When user 2 from twitter authenticates, the user will be logged in as user 1 (facebook).
Isn't this suppose to be unique? Thanks again!
work with mongoYii without yii-user ?
Hi SleepWalker
I just discovered Hoauth, looks really good , thanks for open sourcing it
my problem is I don't use yii-user and have a mongoDB
I'd be glad to port it , but I'd like your feedback first if it's worth it ?
or is it smarter to start from scratch again ?
I'd like to benefit from all the integration work you have already done ?
thanks for sharing your thoughts
Tibor
@Tibor Katelbach
The first and not the good news is that HybridAuth lib is't meintained anymore (but it still works pretty good). So probably it is better to start new extension with the lib that maintained.
In hoauth there are some things that I want to rewrite, but have no time at the moment. But if you want to port it, I will answer all the questions that will occure )
porting
Thanks , why not, I would love to port it .
if HybridAuth Lib isn't maintained anymore
which alternative would you propose ?
should we start over or remain on HybridAuth ?
I'm going to need this asap , So it's a good time to think about it
Awsome
hello,i have use this extension,
for sign up purpose,
it means when user sign up using this
then i just get the info and save my database table,
but i face problem,only in case of facebook and google they are not logout,
when i have already used the before redirect in my login action $oauth->logout();
is it logout problem,and i saw the facebook and gmail are not logout.
@mostofa62
Hello,
You should use yii's CWebUser method to logout the user:
Yii::app()->user->logout()
. The logout method from OAuth model calls only the logout method of HybridAuth lib. Probably I will add there the Yii's logout call too. But for now you should useYii::app()->user->logout()
Returns blank page?
The popup page, http://mysite.com/site/oauth?provider=Facebook, return blank page.
I dont get any error. What should i do..
Am pretty confused..
can i get user facebook image
hi
i love this ext
and i need to ask
if i want to access to user facebook image or frends
how it work
and does i do it
thank you
@malkabani.com
Image it is simply the
photoURL
property of User's profile object.And the information about friends you can get with
$adapter->getUserContacts()
, e.g.~~~
php
$oAuth = UserOAuth::model()->authenticate($provider);
$userContacts = $oAuth->adapter->getUserContacts();
var_dump($userContacts);
~~~
I haven't tested this functionality...
More info you can find here and here.
use it with api
hi
i have website with api to contact with it
and i want to use this extension in my site
so i need to generate authkey for each user after login in
so i need to store authkey in database (on table user)or another table
is this rigth or not
if this wrog
what is the best idea to do it
thank you loot
hoauthAfterLogin
hi
i add this code in controller.php
public static function hoauthAfterLogin($user, $newUser){ $oAuth = UserOAuth::model()->authenticate("facebook"); $userContacts = $oAuth->adapter->getUserContacts(); echo "<pre>"; print_r($userContacts); }
but when run the code i got this meesage
and when i put it in siteController, it works fine
what is the problem
@malkabani.com
That method should be in the same controller as
HOAuthAction
action.The rest I can't understand :) on which line you has
Trying to get property of non-object
? On those, wheregetUserContacts()
is called?disable form after login
hi i use yii-user with hoauth
and i want to disable form that appear after login for first time
and i want to save user information automaticly
with ut this form
how i do it
thank you
disable form after login
malkabani.com, If you mean the form for confirming existing account with password, you can disable this with
alwaysCheckPass => false
property ofHOAuthAction
.if you mean the form that asks for username you should change
yii-user
'sUser
model so that theusername
field becomes not required.get user attributes
Hi.
In SiteController we can specify the model and attributes to be attached.
'oauth' => array( 'class' => 'ext.hoauth.HOAuthAction', 'model' => 'User', 'attributes' => array( 'email' => 'email', // 'first_name' => 'firstName', // 'second_name' => 'lastName', ), ),
What if first_name and last_name (gender, date of birth, etc.) are in another model, and I want them to be attached as well?
Thanks in advance
@laz karimov
Hi,
For now I can suggest you to create virtual attributes in
User
model and save the to the related model inUser::afterSave()
method.You can also use the following callbacks (simply create the method with coresponding name in your controller):
::hoauthCheckAccess(CActiveRecord $user)
::hoauthAfterLogin(CActiveRecord $user, boolean $isNewUser)
Another option is to use
::hoauthProcessUser()
callback, but in this case you will need too much of copy pasteP.S. I will introduce new callbacks soon, as long as I will finish with refactoring
Tutorial
Hi,
I've written an extensive tutorial on how to install both hoauth and Yii-user, and modify according to your needs.
I'm hoping this will help someone. You can find the article here.
@begemotik
Thank you for contributing, Serge. Very nice article! I think, it should be in the ext description :)
Refresh token
Is there a way to keep the refresh token on second login with Google?
Seems that Google returns refresh token only on first login. If lost for some reason, the access should be revoked and only then G will return the token again.
Demo with yii-user is failing
I found your extension very interesting, especially its integration with yii-user. However, demo for both, you provided seems to be failing:
Clicking "Login with OpenID" ends with exception: "OpenID adapter require the identity provider identifier 'openid_identifier' as an extra parameter".
I'm unable to login with Facebook. First click opens Facebook's authorization for your demo app, but after that, user must change name, because names comming from Facebook always contains space (between first and second name) and your app does not allows that. After changing name, confirmation e-mail is sent. After activating account another click to "Login with Facebook" ends with an error: "This E-mail is taken by another user. If this is your account, enter password in field below or change E-mail and leave password blank". After filling-up password field with correct password (this should not happen, since we're using oauth), "Sorry, but password is incorrect" error appears.
You may want to investigate this further.
Let user register normally when connected
Hi,
If you connect with a network to register, the registration form that follows instantly displays an error (ie 'Username must be azAZ0-9' or 'Email cannot be blank'). This looks ugly and it looks like hoauth is automatically trying to submit the credentials it received from the network.
I want to let users connect to a network, have hoauth automatically fill in some details in the registration form that follows (username, email, etc), and also let the user fill in password etc. so they can also log in with username/password instead of being forced to use the network they chose.
Is there a way to do this?
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.