21

I just saw http://uservoice.com/login. It uses Google accounts, Myspace, Yahoo, OpenID and all to sign in customers into its site? Can I do that?

I mean, customers need not register to my site. They can just sign in with their accounts on the above sites.

If you've a solution, I'd prefer a PHP and MySQL based one.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Abdulsattar Mohammed
  • 10,154
  • 13
  • 52
  • 66

7 Answers7

15

See here: Google Login PHP Class.

Also be sure to refer to the Google Federated Login site for more info.

Jason Capriotti
  • 1,836
  • 2
  • 17
  • 33
Yaakov Ellis
  • 40,752
  • 27
  • 129
  • 174
5

You may want to look at this too: https://rpxnow.com/ - it will only need integrating at the HTML/javascript level.

It's what http://uservoice.com/login appears to use.

DanSingerman
  • 36,066
  • 13
  • 81
  • 92
4

You should look at the OpenID Enablded PHP library (http://www.openidenabled.com/php-openid/).

This should play pretty nicely with any LAMP installation without needing to use Zend.

sh1mmer
  • 1,316
  • 11
  • 19
2

Zend_OpenId from Zend Framework

Zend_OpenId is a Zend Framework component that provides a simple API for building OpenID-enabled sites and identity providers.

Karsten
  • 14,572
  • 5
  • 30
  • 35
1

http://openidenabled.com/php-openid/

1

Uservoice users RPX http://rpxnow.com . You can easily use it with PHP, just https and parse the json or xml repsonse. You don't even need to change your database schema or store anything locally.

ltd
  • 194
  • 1
  • 2
-1

i think is good solution for you step by step

1-download openid

2-create file called login.php like this (in same directory or change require_one to your own ) :

<?php
require_once 'openid.php';
$myopenid = new LightOpenID("your-domain.com");//no problem even if u can write http://localhost

if ($myopenid->mode) {
    if ($myopenid->mode == 'cancel') {
        echo "User has canceled authentication !";
    } elseif($myopenid->validate()) {
        $data = $myopenid->getAttributes();
        $email = $data['contact/email'];
        $first = $data['namePerson/first'];
        echo "Identity : $openid->identity <br>";
        echo "Email : $email <br>";
        echo "First name : $first";
    } else {
        echo "The user has not logged in";
    }
} else {
    echo "Go to index page to log in.";
}
?>

3-next is about creating file called index.php:

<?php
require_once 'openid.php';
$openid = new LightOpenID("your-domain.com");//no problem even if u can write http://localhost

$openid->identity = 'https://www.google.com/accounts/o8/id';
$openid->required = array(
  'namePerson/first',
  'namePerson/last',
  'contact/email',
);
$openid->returnUrl = 'your-domain.com/login.php'
?>



<a href="<?php echo $openid->authUrl() ?>">Login with Google</a>

i almost forgot for log out u can kill session;

Alireza Rahmani Khalili
  • 2,727
  • 2
  • 32
  • 33