用于解决腾讯社区开放平台非标准OAuth协议的登录。 有关于腾讯社区开放平台的QQ登录的更多信息,详情请查阅http://connect.opensns.qq.com
Yii 1.1.5 以上, PHP5.3以上; (其他平台未测试)
return array( .... 'components' => array( .... 'oauth' => array( 'key' => 'xxxxx', 'secret' => 'xxxxx', 'callback' => '/site/callback', 'class' => 'application.components.QQOAuth', ), ), );
$oauth = Yii::app()->oauth; $oauth->fetchOAuthToken(); $requestToken = $oauth->requestToken; $requestSecret = $oauth->requestSecret;
$token = $_GET['oauth_token']; $vericode = $_GET['oauth_vericode']; $oauth->fetchAccessToken($token, $vericode); $at = $oauth->accessToken; $as = $oauth->accessSecret; $userInfo = $oauth->fetchUserInfo($at, $as); // $userInfo will be an array include nickname and avatar URL. // for detail, please check http://wiki.opensns.qq.com/wiki/%E3%80%90QQ%E7%99%BB%E5%BD%95%E3%80%91get_user_info
Total 1 comment
非常好用的一个组件啊,有效的减少了,用户注册的麻烦
Leave a comment
Please login to leave your comment.