1

I am storing $lightopenid->identity in a codeigniter session as follows:

            $lightopenid           = new Lightopenid;
            $lightopenid->required = array('contact/email');

            if ($lightopenid->validate()) {

                $google_open_id = $lightopenid->identity;
                $this->session->set_userdata('google_open_id', $google_open_id);
             }

In a separate function in my controller I would like to retrieve the user's email.

            print_r($this->session->userdata('google_open_id'));

will show me the identity link but how do I retrieve the email from it?

Do I need a new instance of lightopenid?

Any suggestions?

pepe
  • 9,799
  • 25
  • 110
  • 188
  • look [here](http://stackoverflow.com/questions/3995011/log-in-the-user-with-lightopenid/3999068#3999068) – tttony Sep 15 '11 at 04:04
  • ttony and @jeff - i had seen that question before posting, but still don't think mine is a dupe - the question you link to does not address the issue of needing to retrieve the email ***via codeigniter session, in a controller that is not the one in which the lightopenid object was created*** – pepe Sep 15 '11 at 19:51

1 Answers1

0

You have to store the email in the session. LightOpenID doesn't store anything. You'd have to redo the whole authentication in order to retrieve the email address only from the identity.

So, something like that:

if($openid->validate()) {
    $attributes = $openid->getAttributes();
    $this->session->set_userdata('open_id', $openid->identity);
    $this->session->set_userdata('email', $attributes['email']);
}
Mewp
  • 4,715
  • 1
  • 21
  • 24