好的,我的问题是有些供应商支持 SREG 而有些只支持 AX 我需要知道如何从供应商那里请求他们支持哪些方法。我试着在这里查看文档 http://openidenabled.com/files/php-openid/docs/2.1.3/但我什么也没看到。
最佳答案
遇到了类似的问题。
下面的代码应该能帮到你。
如果
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
}
这将帮助您诊断即将到来的数据,SREG 或属性交换
关于php - JanRain PHP OpenID : How to check if a provider supports AX programmatically?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2461346/