我正在尝试使用 php-openid 库在我的站点中实现 openID。 其包中的基本消费者示例不适用于 Google 和 Yahoo。 我在这里找到了谷歌解决方案: Example usage of AX in PHP OpenID 但它仍然不适用于 Yahoo! . 我怎样才能让它发挥作用?
最佳答案
哇,现在解决了!!!!
我跟踪了函数并发现了问题。那就是...... 在我使用的“try_auth.php”文件中
"$attribute[] = Auth_OpenID_AX_AttrInfo::make('http://axschema.org/contact/email',2,1, 'email');"
用于从提供商处获取用户电子邮件。它在 Google 中运行良好,因为 Google 忽略“2”(请求的电子邮件地址的计数),但在 Yahoo!它为它生成 [count.email] => 2(在 getSignedNS 函数中)并且在 Yahoo 响应中没有 count.email 的条目。它导致在雅虎的 getSignedNS 中返回 null。 我变了
"$attribute[] = Auth_OpenID_AX_AttrInfo::make('http://axschema.org/contact/email',2,1, 'email');"
到
"$attribute[] = Auth_OpenID_AX_AttrInfo::make('http://axschema.org/contact/email',1,1, 'email');"
它现在工作正常,并返回我从两个提供商那里请求的任何东西!!!
大声笑...
关于php-openID 不适用于雅虎,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2616123/