Yii extensions to use for oauth connections

I am new to Yii - meaning I’ve read about it for a while, but never had the chance to use it. I like how it seems to be fast in development, and would like to try it for a new application.

Here’s the workflow, in short:

  • Authenticate with Google to read recent posts on Google+

  • Once Google authentication is successful, show a dialog to add Twitter and Facebook via oauth

  • Authenticate with Twitter and/or Facebook and save oauth credentials

  • Show a dialog where the user checks off Twitter account(s) and Facebook Profile or Pages to send updates to

  • Via a cronjob, check for updates for each user on Google+, and if any newer than previously imported are found, post the information to the destinations in the previous step

I’d like to know what extensions would fit this (it’s also a nice way to test if this community is active) :wink:

Also, are there any shortcuts in Yii (or using Yii in some way) I can use to get this created faster?

I appreciate any comments! :smiley:

My yiiauth is a i wrapper for hybridauth. http://www.yiiframework.com/extension/yiiauth/

Which easily solves your authentication problems, but you will still have to create a User class,

and the workflow ofc.

the modal thing is solved with CJuiDialog,if you dont like the looks there is an insane amount of jquery dialog scripts on the internet, some is wrapped as extension in the yii library(like bootstrap modals)

Cronjobs I have no knowledge about.

Thanks for the suggestions, ill have a look at them :)

@Sampa I’m getting started with this installation, but have to ask you about the instructions you wrote on http://www.yiiframework.com/forum/index.php/topic/32250-module-yiiauth/

I created a ‘Social’ model - correct?

I have installed the yii-user-management module, but cannot locate the UserIdentity model there. Or am I missing the place where I have to build one?

When using YUM, the UserIdentity you’re after will be in modules.user.components - called YumUserIdentity

Thanks, PrplHaz4. I’d assume that I need to create a UserIdentity class, extending YumUserIdentity and adjusting it to fit yiiauth…(?)

I haven’t been able to find all the information about where these classes fit together though - read a short tut about registration and figured I’d adapt it to use G+ instead of filling out a form, but some parts of the “glue” in a yii app still elude me.

Any suggestions for tutorials, documentation or other is welcome, as well as a step-by-step walkthrough of what I need to do to create this app…


I just got Sampa’s Yiiauth extension working with YUM (really, think of each auth method/login provider as just another way to call user->login(); ) The way my app was configured, I had a User class which extended YumUser, so I just pointed yiiauth to my “User” class, and it seems to be working.

I think a pretty good understanding of this section of the guide is necessary for working in this space…for me it meant that i had to actually write it a few times and just try to make it work before I really understood what was going on.


Appreciate the discussion. Perhaps someone who had success making the YUM play nice with Yiiauth, could offer some advise. Problem occurs basically when user is not logged in through YUM but has successfully connected to a provider. My expectation (based on code) is the user’s social network credentials get saved to the YUM user file.

Here’s a code snippet from Yiiauth.php.


if ( &#33;Yii::app()-&gt;user-&gt;isGuest ){

			&#036;social-&gt;yiiuser = Yii::app()-&gt;user-&gt;id;	

			&#036;user = &#036;userClass::model()-&gt;findByPk(Yii::app()-&gt;user-&gt;id);


		// we want to create a new &#036;userClass

			&#036;user = new &#036;userClass;

			&#036;user-&gt;username = &#036;provideruser; 

			if ( &#036;user-&gt;save() ){ //we get an user id

				&#036;social-&gt;yiiuser = &#036;user-&gt;id;




I made this combo work for the author of this thread, and he agreed to share it so lets hope he does so, I dont have the code. If I can remember correctly it was a few stuff that had to be changed.

But it was not much just a bit sneaky. I assume the problem you get is due to the UserClass setting in the config

could be wrong, ‘userClass’=>YumUser (i think…). that

and extending the UserIdentity provided in yiiauth from YumUserIdentity (i think…) insted of CUserIdentity.

This should solve the login problems.

Also, one guy here is working on a better version of hybridauth for yii, says one week. could be worth to keep an eye out for aswell.

Thanks for reply.

I was okay on both issues you point out. In the end I opted to include the registration code $user->register($user->username,’’,’’);

and that sorted out getting the social user into user table.

I will certainly look out for the ‘better’ version, but I really learned a lot going through this version.