Google登录集成

问题描述:

我对社交网络登录API非常陌生。现在我正在Google登录集成中工作。Google登录集成

我已经与OpenID示例类测试,并得到了像以下:

https://www.google.com/accounts/o8/id?id=ID

我怎样才能获取值从这个(用户信息,好友列表等)?

我需要为此创建任何谷歌应用程序?

你能请任何人帮我整合这个。

谢谢您的关注。

您可以使用LightOpenID更方便地访问用户信息。您可以访问AX/SREG扩展很容易

> AX and SREG extensions are supported. * To use them, specify 
> $openid->required and/or $openid->optional before calling 
> $openid->authUrl(). * These are arrays, with values being AX schema 
> paths (the 'path' part of the URL). * For example: * 
> $openid->required = array('namePerson/friendly', 'contact/email'); * 
> $openid->optional = array('namePerson/first'); * If the server 
> supports only SREG or OpenID 1.1, these are automaticaly * mapped to 
> SREG names, so that user doesn't have to know anything about the 
> server. 
> To get the values, use $openid->getAttributes(). 

<?php 

# Logging in with Google accounts requires setting special identity, so this example shows how to do it. 
require 'openid.php'; 
try { 
    $openid = new LightOpenID; 
    $openid->required = array('namePerson/friendly', 'contact/email'); 
    $openid->optional = array('namePerson/first'); 

    if(!$openid->mode) { 
     if(isset($_GET['login'])) { 
      $openid->identity = 'https://www.google.com/accounts/o8/id'; 
      header('Location: ' . $openid->authUrl()); 
     } 
?> 
<form action="?login" method="post"> 
    <button>Login with Google</button> 
</form> 
<?php 
    } elseif($openid->mode == 'cancel') { 
     echo 'User has canceled authentication!'; 
    } else { 
     echo 'User ' . ($openid->validate() ? $openid->identity . ' has ' : 'has not ') . 'logged in.'; 
     echo "<p>"; 
     print_r($openid->getAttributes()); 
     echo "</p>"; 
    } 
} catch(ErrorException $e) { 
    echo $e->getMessage(); 
} 


` print_r($openid->getAttributes());` shows email name which was required because `$openid->required = array('namePerson/friendly', 'contact/email');` I wonder why friendly is not shown, but I don't even think I set one for gmail. 

得到朋友你应该学习Google Friend Connect列表信息。也许这个链接可能对你有帮助=>http://docs.opensocial.org/display/OSD/Integrating+your+PHP+site+with+Google+Friend+Connect+and+Open+Social