0
votes

I'm testing and learning the php-openid library at here: https://github.com/openid/php-openid

I downloaded the whole package and uploaded examples/consumer to http://www.example.com/openid and also uploaded Auth to http://www.example.com/Auth because my website only needs to be a relying party.

It's working correctly when I tested it with one of my openids and it displays "You have successfully verified xxxxx as your identity. "

However, it DOES NOT return any SREG attributes such as email or name which my openid profile does have these information.

I didn't make any change to any of the consumer example files (index.php, try_auth.php, finish_auth.php, nor common.php), so the code looks like this:

In try_auth.php:

$sreg_request = Auth_OpenID_SRegRequest::build(
                                 // Required
                                 array('nickname'),
                                 // Optional
                                 array('fullname', 'email'));

if ($sreg_request) {
    $auth_request->addExtension($sreg_request);
}

In finish_auth.php:

$sreg = $sreg_resp->contents();

if (@$sreg['email']) {
    $success .= "  You also returned '".escape($sreg['email']).
        "' as your email.";
}

if (@$sreg['nickname']) {
    $success .= "  Your nickname is '".escape($sreg['nickname']).
        "'.";
}

if (@$sreg['fullname']) {
    $success .= "  Your fullname is '".escape($sreg['fullname']).
        "'.";
}

I tried:

$sreg = $sreg_resp->contents();
print_r($sreg);

But it turned out to be an empty array:

Array
(
)

I tried:

And it all ends up with an empty array of $sreg.

I tried lightopenid which uses AX rather than SREG:

  • contact/email
  • namePerson

And they are correctly returning the values.

So how can I make the php-openid library return the attributes I need?

1

1 Answers

0
votes

Does the provider actually returned the SREG attributes? What is the HTTP response you are sending from try_auth.php? What is the HTTP request that you received on finish_auth.php?