views:

38

answers:

2

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['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?

A: 

Have you tried CodeIgniter’s OpenID library?

Mitchell McKenna
A: 

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

Ashley