Frage

I'm trying to get data using LightOpenID. As is, the code below is working, but if I un-comment the lines to get more info it times out and doesn't show any errors. What am I doing wrong?

require_once('inc/func/_functions.php');
require ('inc/libs/openid.php');
initSession();
try {
$openid = new LightOpenID('tutordelphia.com');
if(!$openid->mode) {
    $openid->identity = 'https://www.google.com/accounts/o8/id';
    $openid->required = array (
       'contact/email',
//     'namePerson/first',
//     'namePerson/last'
    );
    header('Location: ' . $openid->authUrl());
} elseif($openid->mode == 'cancel') {
 echo 'User has canceled authentication!';
 } else {
$valid=$openid->validate();
if($valid)
{       
    $data=$openid->getAttributes();
    $_SESSION['user']=new userClass();
    $_SESSION['user']->userID=$_GET['openid_identity'];
    $_SESSION['user']->userEmail=$data['contact/email'];

//  $_SESSION['user']->firstName=$data['namePerson/first'];
//  $_SESSION['user']->lastName=$data['namePerson/last'];
//  $_SESSION['user']->userName=$data['namePerson/first'].$data['namePerson/last'];
    $_SESSION['user']->addUserToDB();
    $_SESSION['user']->createUserCookie();
    header('Location: index.php');
    }
}
   } catch(ErrorException $e) {
   echo $e->getMessage();
}
War es hilfreich?

Lösung

open id is a simple http interface. I suggest you build your own code for it.

As well google has a slightly different twist on open id and doesn't follow the standard. I suggest you try this code against another provider (like OpenID) who does follow the standard. That libary might not handle google correctly. I had some trouble figuring out what google expected with my own library.

From there you can at least determine if the library really works ;)

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top