开发者

Zend_OpenId with Codeigniter

I am using the OpenId library from Zend with CodeIgniter and everything is working just fine except for the verify function.

$status = "";
if (isset($_POST['openid_action']) &&
    $_POST['openid_action'] == "login" &&
    !empty($_POST[开发者_StackOverflow社区'openid_identifier'])) {

    $consumer = new Zend_OpenId_Consumer();
    if (!$consumer->login($_POST['openid_identifier'])) {
        $status = "OpenID login failed.";
    }
} else if (isset($_GET['openid_mode'])) {
    if ($_GET['openid_mode'] == "id_res") {
        $consumer = new Zend_OpenId_Consumer();
        if ($consumer->verify($_GET, $id)) {
            $status = "VALID " . htmlspecialchars($id);
        } else {
            $status = "INVALID " . htmlspecialchars($id);
        }
    } else if ($_GET['openid_mode'] == "cancel") {
        $status = "CANCELLED";
    }
}

The Openid library needs a Zend session to start so I also included that library. I am able to: enter openid, get redirected to 'openid-provider', validate there, and get redirected back.

However, I am not able to retrieve the 'openid_mode', so I'm not able to 'verify' the info. I don't understand what I'm doing wrong. Is it purely that this library will not work with CI without some heavy hacking?


Have you tried CodeIgniter’s OpenID library?


Zend's OpenId system is flawed in many ways (it doesn't work with Google, Yahoo etc). I think you'll be better off with this library instead: http://www.janrain.com/openid-enabled

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜