CI的LightopenID-无法连接到谷歌


LightopenID for CI - Could not connect to google

我遵循本指南(经过修改)使用lightopenid登录CI系统。

我下载了openid.php文件,并将其放在根文件夹(应用程序、资产等文件夹所在的文件夹)上。

在登录页面中,我有以下代码:

<a href="<?php echo base_url('logingoogle/gmail_login');?>" target="_blank">Login using gmail</a>

我的应用程序/控制器/logingogle.php中的代码是:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
Class Logingoogle extends CI_Controller {
function __construct(){
    parent::__construct();
}
function index(){}
function gmail_login(){
    require_once 'openid.php';
    $openid = new LightOpenID(base_url());
    $openid->identity = 'https://www.google.com/accounts/o8/id';
    $openid->required = array(
                                 'namePerson/first'
                                ,'namePerson/last'
                                ,'contact/email'
    );
    $openid->returnUrl = base_url('logingoogle/after_login');
    $openid->authUrl();
}
function after_login(){
    require_once 'openid.php';
    $openid = new LightOpenID(base_url());
    $login_response = '';
    $email = '';
    $first = '';
    if ($openid->mode) {
        if ($openid->mode == 'cancel') {
            $login_response = "User has canceled authentication!";
        } elseif($openid->validate()) {
            $data = $openid->getAttributes();
            $email = $data['contact/email'];
            $first = $data['namePerson/first'];
        } else {
            $login_response = "The user has not logged in";
        }
    }
    else{
        $login_response = "Go to index page to log in.";
    }
    $data['user_details'] = array(
                                     'login_response'   => $login_response
                                    ,'identity'         => $openid->identity
                                    ,'email'            => $email
                                    ,'first'            => $first
    );
    $this->load->view('after_login',$data);
}
}

现在,当我点击"Login using gmail"链接时,它会打开一个新的空白选项卡,加载时间为5分钟(我已经计时)。5分钟后,此错误以纯文本显示:

致命错误:未捕获异常"ErrorException",消息为"连接到www.google.com:443失败;C:''WebServer''Apache2.2''htdocs''ETO''openid.php:229堆栈跟踪:#0 C:''WebServer''Apache2.2''tdocs''ETO ''openid.php(360):LightOpenID->request_curl ''htdocs''ETO''openid.php(671):LightOpenID->discover('http://www.goo…')#3 C:''WebServer''Apache2.2''htdocs''ETO''application''controllers''logingoogle.php ''WebServer''Ap…')#7{main}抛出C: ''WebServer''Apache2.2''htdocs''ETO''openid.php,第229行

以前有人遇到过类似的错误吗?我做错了什么?我无法破译给我的错误信息。请帮忙。

Google需要API证书(客户端ID和客户端机密),因此我建议您使用"OpenIDConnectClientGoogle.class.php"来转换代码。或者使用这个OpenId库

它包含引用的php文件。

如果你想更多地了解谷歌最近的变化,请查看此处