Further instructions for loid for openid auth

Ok, I’m trying to implement OpenID on a test application and am having trouble understanding what to do after authentication brings the user back to the site. I’ve gone through these instructions:

http://www.yiiframework.com/extension/loid/

I also read through this to try to get a better idea of Yii authentication:

I’ve put the code in place mentioned in the first two URLs, but I’m not understanding what I’m supposed to do at the point where it validates and either logs in or fails:


echo $loid->validate() ? 'Logged in.' : 'Failed';

What I would think you’d do there is place code in the logged in part that creates a new user in the local user table that uses the openid email as the username and/or load the said user object from the user table using the email provided from openid. But I’m not sure at that point if I’m authenticated and the session was started or what. This is the first openid application I’ve done, so maybe I’m not understanding something about that process.

I tried putting in:




if ($loid->validate()) {

   $openid_attr_array = $loid->getAttributes();

   $openid_contact_email = $openid_attr_array['contact/email'];


   $identity=new UserIdentity($openid_contact_email);

   Yii::app()->user->login($identity);

   print 'Logged in.';


} else {

   print 'Failed';

}



But that doesn’t seem to be right. Any insight or help into this process is appreciated as there is very little documentation on this and other people seem to have questions about how this works as well.

I guess loid isn’t a commonly used extension? I figured that at least a few people would be using yii with openid.