Ok, my problem is that some providers support SREG and some support only AX I need to know how it is that I can request from the provider which methods they support.. I tried looking through the documentation here http://openidenabled.com/files/php-openid/docs/2.1.3/ but I didn't see anything.
Asked
Active
Viewed 810 times
3
-
Duplicate of http://stackoverflow.com/questions/2422433/openid-simple-registration-sreg-vs-attribute-exchange-ax – keturn Mar 18 '10 at 19:23
1 Answers
2
Faced similar problem.
The below code should help you.
So if
function getReturnTo() {
return sprintf("%s://%s:%s%s/finish_auth.php",
getScheme(), $_SERVER['SERVER_NAME'],
$_SERVER['SERVER_PORT'],
dirname($_SERVER['PHP_SELF']));
}
function &getConsumer() {
/**
* Create a consumer object using the store object created
* earlier.
*/
$store = getStore();
$consumer =& new Auth_OpenID_Consumer($store);
return $consumer;
}
$consumer = getConsumer();
$return_to = getReturnTo();
$response = $consumer->complete($return_to);
$sreg_resp = Auth_OpenID_SRegResponse::fromSuccessResponse($response);
$ax = new Auth_OpenID_AX_FetchResponse();
$obj = $ax->fromSuccessResponse($response);
if($sreg)
{
//sreg is supported, start creating the sreg data array.
}
elseif($obj)
{
// attribute exchange supported. fetch details here
}
this will help you diagnose which data is coming, SREG or Atribute Exchange

Gaurav Sharma
- 2,830
- 1
- 37
- 54
-
How is $response generated? The walkthrough I have simply creates an Auth_OpenID_Consumer object, sets the URL and redirects. The only time I see a response is in the return -- but I would assume sreg or ax needs to be determined prior to authorization. (?) Thanks! – jmccartie Jun 16 '10 at 19:19
-
@jmccartie: I have edited my answer now, it includes where that $response came from. For detailed explanation you can have a look at the files (the code in php files only) in the "examples/consumer/" directory of openid library. – Gaurav Sharma Jun 17 '10 at 06:32
-
But to get that AX in response we will probably need to request it first, like we request SREG? Or how this works? – jayarjo Jul 11 '10 at 05:37