İlk başta openid.php'u indirin ve codeigniter kök klasörünüzü yerleştirin.
1. kopya kodu ve .... olarak kaydetmek/kontrolör/logingoogle.php
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class LoginGoogle extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('login_model');
}
public function index()
{
require_once 'openid.php';
$openid = new LightOpenID("localhost");
$openid->identity = 'https://www.google.com/accounts/o8/id';
$openid->required = array(
'namePerson/first',
'namePerson/last',
'contact/email',
'birthDate',
'person/gender',
'contact/postalCode/home',
'contact/country/home',
'pref/language',
'pref/timezone',
);
// $openid->returnUrl = 'http://localhost/login_thirdparty/login_google.php';
$openid->returnUrl = 'http://localhost/login_thirdparty/codeigniterlogin/index.php/logingoogle/loginAuth';
// echo '<a href="'.$openid->authUrl().'">Login with Google</a>';
$data['openid'] = $openid;
$this->load->view('googleLoginView', $data);
}
public function loginAuth()
{
$this->login_model->index();
}
}
2. kopya kodu ve ..../görünümler/googleLoginView.php olarak kaydetmek
<!DOCTYPE html>
<html lang="en">
<head>
<title>Login using google account</title>
</head>
<body>
<a href = "<?php echo $openid->authUrl(); ?>" > Loging Using google account </a>
</body>
</html>
3. kopya kodu ve farklı kaydet ..../modeller/login_model.php
Nisan 2015'ten beri Google'ın OpenID ile oturum açmasını, tamamen farklı bir halefi olan OpenID Connect ile oturum açmayı devre dışı bıraktığını unutmayın: https://developers.google.com/identity/protocols/OpenID2Migration –