qq配置文件
路径:application/config/isetting/qq_setting.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* @qq互联配置信息
* 默认开启get_user_info模块
* **/
$config['inc_info'] = array(
array (
'appid' => '101091040',
'appkey' => '7cb031049f2c900fea809424e614a968',
'callback' => '此为绑定的url/qqcallback.php'
),
array (
'get_user_info' => '1',
'add_topic' => '0',
'add_one_blog' => '0',
'add_album' => '0',
'upload_pic' => '0',
'list_album' => '0',
'add_share' => '0',
'check_page_fans' => '0',
'add_t' => '0',
'add_pic_t' => '0',
'del_t' => '0',
'get_repost_list' => '0',
'get_info' => '0',
'get_other_info' => '0',
'get_fanslist' => '0',
'get_idollist' => '0',
'add_idol' => '0',
'del_idol' => '0',
'get_tenpay_addr' => '0',
)
);
根目录下的,qqcallback.php
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
//新浪微博登录回调入口文件,将路径转移到login/callback方法里,并将code值传过去
$code ='';
$state='';
$url = '';
$str ='';
$code = $_REQUEST['code'];
$state = $_REQUEST['state'];
$url = "/login/qqcallback";
//die('ssss');
$str = "<!doctype html>
<html>
<head>
<meta charset=\"UTF-8\">
<title>自动跳转</title>
</head>
<body>";
$str .="<form action=\"{$url}\" method=\"post\" id=\"form\" autocomplete='off'>";
$str .="<input type='hidden' name='code' value='{$code}'>";
$str .="<input type='hidden' name='state' value='{$state}'>";
$str .=" <!--<p><input type='submit' value='go'/></p> -->
</form>
</body>
</html>
<script type=\"text/javascript\">
document.getElementById('form').submit();
</script>";
echo $str;
login控制器下的qqcallback方法
public function qqcallback(){
header("content-type: text/html; charset=utf-8");
$this->load->library('tencent/oauth','oauth');
$this->load->model("user_reg_model","user_reg");
$code = $_REQUEST['code'];
$state = $_REQUEST['state'];
$CI = &get_instance();
$CI->config->load('isetting/qq_setting');
$setting = $CI->config->item('inc_info');
$appid = $setting[0]['appid'];
$arr =array();
$arr = $this->oauth->qq_callback($code,$state,$appid);
// echo "<pre>";print_r($arr);die();
$res = $this->third->select_third(array("qq_id"=>$arr['openid']));
if(!empty($res)){
$user_info = $this->user_reg->user_detect(array("id"=>$res['user_id']));
if($user_info['status']){
echo "<script>alert('您登陆的账号还未激活');location='/login/index';</script>";die();
}
$datas = $this->third->select_user_qqname($arr['openid']);
// echo "<pre>";print_r($datas);die();
$uname = $datas['username'];
$password = $datas['password'];
$this->load->model("login_model","login");
$this->login->validation($uname,$password);
echo "<script>alert('登录成功!');location='/user_center'</script>";die();
}else{
$this->session->set_userdata('qq_id',$arr['openid']);
echo "<script>if(!confirm('是否在平台注册过用户?')){location='/register/index'}else{location='/login'};</script>";
}
}
models下的模型
<?php
/**
* Description of third_login_model
*新浪接口授权及登录model
* @author
*/
class third_login_model extends CI_Model{
//put your code here
private $sina=array();
private $qq =array();
private $users ='';
private $third='';
public function __construct() {
parent::__construct();
// $this->l = DIRECTORY_SEPARATOR;
$this->load->database();
$this->load->library('session');
include_once APPPATH."/libraries"."/saetv2.ex.class.php";
$this->third = $this->db->dbprefix.'_third_login';
$this->users = $this->db->dbprefix.'_user_reg';
$this->config->load("sina_conf");
$this->sina= $this->config->item("sina_conf");
}
/**
* @uses : 新浪微博登录
* @param :
* @return : $sina_url----登录地址
*/
public function sina_login(){
$obj = new SaeTOAuthV2($this->sina['App_Key'],$this->sina['App_Secret']);
$sina_url = $obj->getAuthorizeURL( $this->sina['WB_CALLBACK_URL'] );
return $sina_url;
}
/**
* @uses : 登录后,通过返回的code值,获取token,实现授权完成,然后获取用户信息
* @param : $code
* @return : $user_message--用户信息
*/
public function sina_callback($code){
$obj = new SaeTOAuthV2($this->sina['App_Key'],$this->sina['App_Secret']);
if (isset($code)) {
$keys = array();
$keys['code'] = $code;
$keys['redirect_uri'] = $this->sina['WB_CALLBACK_URL'];
try {
$token = $obj->getAccessToken( 'code', $keys ) ;//完成授权
} catch (OAuthException $e) {
}
}
$c = new SaeTClientV2($this->sina['App_Key'], $this->sina['App_Secret'], $token['access_token']);
$ms =$c->home_timeline();
$uid_get = $c->get_uid();//获取u_id
$uid = $uid_get['uid'];
$user_message = $c->show_user_by_id($uid);//获取用户信息
return $user_message;
}
/**
* @uses : 查询第三方登录表
* @param : $where
* @return : 第三方登录用户记录结果集
*/
public function select_third($where) {
$result = false;
$this->db->select();
$this->db->from($this->third);
$this->db->where($where);
$query = $this->db->get();
if($query){
$result = $query->row_array();
}
return $result;
}
/**
* @uses : sina查询用户表和第三方登录表
* @param : $where
* @return : 第三方登录用户记录结果集
*/
public function select_user_name($where) {
$field ="user.id,user.password,user.username,utl.*";
$sql = "select {$field} from {$this->third} as utl "
." left join {$this->users} as user on user.id=utl.user_id"
. " where utl.sina_id={$where}";
$query = $this->db->query($sql);
$result = $query->row_array();
return $result;
}
/**
* @uses : qq查询用户表和第三方登录表
* @param : $where
* @return : 第三方登录用户记录结果集
*/
public function select_user_qqname($where) {
$field ="user.id,user.password,user.username,utl.*";
$sql = "select {$field} from {$this->third} as utl "
." left join {$this->users} as user on user.id=utl.user_id"
. " where utl.qq_id='{$where}'";
$query = $this->db->query($sql);
$result = $query->row_array();
return $result;
}
// public function insert_third($datas){
// if (!is_array($datas)) show_error ('wrong param');
// $res ='';
// $res = $this->db->insert($this->third, $datas);
// return $res;
// }
//
// public function up_third($datas) {
//
// }
public function binding_third($datas) {
if (!is_array($datas)) show_error ('wrong param');
if($datas['sina_id']==0 && $datas['qq_id']==0) return;
$resa ='';
$resb ='';
$resa = $this->select_third(array("user_id"=>$datas['user_id']));
$temp =array(
"user_id"=>$datas['user_id'],
"sina_id"=>$resa['sina_id']!=0 ? $resa['sina_id'] : $datas['sina_id'],
"qq_id" => $resa['qq_id']!=0 ? $resa['qq_id'] : $datas['qq_id'],
);
if($resa){
$resb = $this->db->update($this->third, $temp,array("user_id"=>$datas['user_id']));
}else{
$resb = $this->db->insert($this->third,$temp);
}
if($resb) {
$this->session->unset_userdata('sina_id');
$this->session->unset_userdata('qq_id');
}
return $resb;
}
}
libraries/tencent/oauth.php在下载附件中
新浪配置文件
application/config/sina_conf.php
<?php
$config["sina_conf"] = array( //测试机
"App_Key" => '1498005339',
"App_Secret" =>'f1c6277a38b39f764c76a1190750a6dc',
"WB_CALLBACK_URL" => 'http://.../callback.php'
);
根目录下的回调地址 callback.php
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
//新浪微博登录回调入口文件,将路径转移到login/callback方法里,并将code值传过去
$code ='';
$url = '';
$str ='';
$code = $_REQUEST['code'];
$url = "/login/callback";
$str = "<!doctype html>
<html>
<head>
<meta charset=\"UTF-8\">
<title>自动跳转</title>
</head>
<body>";
$str .="<form action=\"{$url}\" method=\"post\" id=\"form\" autocomplete='off'>";
$str .="<input type='hidden' name='code' value='{$code}'>";
$str .="</form>
</body>
</html>
<script type=\"text/javascript\">
document.getElementById('form').submit();
</script>";
echo $str;
请求的方法
//流程原理:
// 1.通过code获得access_token通过授权,并获取用户的信息(包括用户u_id)
// 2.查询第三方登录表,如果存在用户id,查询用户表,如果邮箱已经激活,就直接登录,如果没有激活,提示用户去邮箱激活帐号
// 3.查询第三方登录表,如果不存在用户id,分2种情况,一:用户在平台已经有帐号了,这时需要把平台user_reg用户id绑定到第三方登录表,然后就让客户登录
// 二:如果用户在平台没有帐号,跳转至注册页面注册,注册的同时,信息写入uer_reg表,同时也把用户id写入第三方登录表进行绑定
public function callback(){
header("content-type: text/html; charset=utf-8");
$this->load->model("user_reg_model","user_reg");
$code = $_REQUEST['code'];//code值由入口文件callback.php传过来
$arr =array();
$arr = $this->third->sina_callback($code);//通过授权并获取用户信息(包括u_id)
$res = $this->third->select_third(array("sina_id"=>$arr['id']));
if(!empty($res)){
$user_info = $this->user_reg->user_detect(array("id"=>$res['user_id']));
if($user_info['status']){
echo "<script>alert('您登陆的账号还未激活');location='/login/index';</script>";die();
}
$datas = $this->third->select_user_name($arr['id']);
// echo "<pre>";print_r($datas);die();
$uname = $datas['username'];
$password = $datas['password'];
$this->load->model("login_model","login");
$this->login->validation($uname,$password);
echo "<script>alert('登录成功!');location='/user_center'</script>";die();
}else{
$this->session->set_userdata('sina_id',$arr['id']);
echo "<script>if(!confirm('是否在平台注册过用户?')){location='/register/index'}else{location='/login'};</script>";
}
}
路径:application/config/isetting/qq_setting.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* @qq互联配置信息
* 默认开启get_user_info模块
* **/
$config['inc_info'] = array(
array (
'appid' => '101091040',
'appkey' => '7cb031049f2c900fea809424e614a968',
'callback' => '此为绑定的url/qqcallback.php'
),
array (
'get_user_info' => '1',
'add_topic' => '0',
'add_one_blog' => '0',
'add_album' => '0',
'upload_pic' => '0',
'list_album' => '0',
'add_share' => '0',
'check_page_fans' => '0',
'add_t' => '0',
'add_pic_t' => '0',
'del_t' => '0',
'get_repost_list' => '0',
'get_info' => '0',
'get_other_info' => '0',
'get_fanslist' => '0',
'get_idollist' => '0',
'add_idol' => '0',
'del_idol' => '0',
'get_tenpay_addr' => '0',
)
);
根目录下的,qqcallback.php
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
//新浪微博登录回调入口文件,将路径转移到login/callback方法里,并将code值传过去
$code ='';
$state='';
$url = '';
$str ='';
$code = $_REQUEST['code'];
$state = $_REQUEST['state'];
$url = "/login/qqcallback";
//die('ssss');
$str = "<!doctype html>
<html>
<head>
<meta charset=\"UTF-8\">
<title>自动跳转</title>
</head>
<body>";
$str .="<form action=\"{$url}\" method=\"post\" id=\"form\" autocomplete='off'>";
$str .="<input type='hidden' name='code' value='{$code}'>";
$str .="<input type='hidden' name='state' value='{$state}'>";
$str .=" <!--<p><input type='submit' value='go'/></p> -->
</form>
</body>
</html>
<script type=\"text/javascript\">
document.getElementById('form').submit();
</script>";
echo $str;
login控制器下的qqcallback方法
public function qqcallback(){
header("content-type: text/html; charset=utf-8");
$this->load->library('tencent/oauth','oauth');
$this->load->model("user_reg_model","user_reg");
$code = $_REQUEST['code'];
$state = $_REQUEST['state'];
$CI = &get_instance();
$CI->config->load('isetting/qq_setting');
$setting = $CI->config->item('inc_info');
$appid = $setting[0]['appid'];
$arr =array();
$arr = $this->oauth->qq_callback($code,$state,$appid);
// echo "<pre>";print_r($arr);die();
$res = $this->third->select_third(array("qq_id"=>$arr['openid']));
if(!empty($res)){
$user_info = $this->user_reg->user_detect(array("id"=>$res['user_id']));
if($user_info['status']){
echo "<script>alert('您登陆的账号还未激活');location='/login/index';</script>";die();
}
$datas = $this->third->select_user_qqname($arr['openid']);
// echo "<pre>";print_r($datas);die();
$uname = $datas['username'];
$password = $datas['password'];
$this->load->model("login_model","login");
$this->login->validation($uname,$password);
echo "<script>alert('登录成功!');location='/user_center'</script>";die();
}else{
$this->session->set_userdata('qq_id',$arr['openid']);
echo "<script>if(!confirm('是否在平台注册过用户?')){location='/register/index'}else{location='/login'};</script>";
}
}
models下的模型
<?php
/**
* Description of third_login_model
*新浪接口授权及登录model
* @author
*/
class third_login_model extends CI_Model{
//put your code here
private $sina=array();
private $qq =array();
private $users ='';
private $third='';
public function __construct() {
parent::__construct();
// $this->l = DIRECTORY_SEPARATOR;
$this->load->database();
$this->load->library('session');
include_once APPPATH."/libraries"."/saetv2.ex.class.php";
$this->third = $this->db->dbprefix.'_third_login';
$this->users = $this->db->dbprefix.'_user_reg';
$this->config->load("sina_conf");
$this->sina= $this->config->item("sina_conf");
}
/**
* @uses : 新浪微博登录
* @param :
* @return : $sina_url----登录地址
*/
public function sina_login(){
$obj = new SaeTOAuthV2($this->sina['App_Key'],$this->sina['App_Secret']);
$sina_url = $obj->getAuthorizeURL( $this->sina['WB_CALLBACK_URL'] );
return $sina_url;
}
/**
* @uses : 登录后,通过返回的code值,获取token,实现授权完成,然后获取用户信息
* @param : $code
* @return : $user_message--用户信息
*/
public function sina_callback($code){
$obj = new SaeTOAuthV2($this->sina['App_Key'],$this->sina['App_Secret']);
if (isset($code)) {
$keys = array();
$keys['code'] = $code;
$keys['redirect_uri'] = $this->sina['WB_CALLBACK_URL'];
try {
$token = $obj->getAccessToken( 'code', $keys ) ;//完成授权
} catch (OAuthException $e) {
}
}
$c = new SaeTClientV2($this->sina['App_Key'], $this->sina['App_Secret'], $token['access_token']);
$ms =$c->home_timeline();
$uid_get = $c->get_uid();//获取u_id
$uid = $uid_get['uid'];
$user_message = $c->show_user_by_id($uid);//获取用户信息
return $user_message;
}
/**
* @uses : 查询第三方登录表
* @param : $where
* @return : 第三方登录用户记录结果集
*/
public function select_third($where) {
$result = false;
$this->db->select();
$this->db->from($this->third);
$this->db->where($where);
$query = $this->db->get();
if($query){
$result = $query->row_array();
}
return $result;
}
/**
* @uses : sina查询用户表和第三方登录表
* @param : $where
* @return : 第三方登录用户记录结果集
*/
public function select_user_name($where) {
$field ="user.id,user.password,user.username,utl.*";
$sql = "select {$field} from {$this->third} as utl "
." left join {$this->users} as user on user.id=utl.user_id"
. " where utl.sina_id={$where}";
$query = $this->db->query($sql);
$result = $query->row_array();
return $result;
}
/**
* @uses : qq查询用户表和第三方登录表
* @param : $where
* @return : 第三方登录用户记录结果集
*/
public function select_user_qqname($where) {
$field ="user.id,user.password,user.username,utl.*";
$sql = "select {$field} from {$this->third} as utl "
." left join {$this->users} as user on user.id=utl.user_id"
. " where utl.qq_id='{$where}'";
$query = $this->db->query($sql);
$result = $query->row_array();
return $result;
}
// public function insert_third($datas){
// if (!is_array($datas)) show_error ('wrong param');
// $res ='';
// $res = $this->db->insert($this->third, $datas);
// return $res;
// }
//
// public function up_third($datas) {
//
// }
public function binding_third($datas) {
if (!is_array($datas)) show_error ('wrong param');
if($datas['sina_id']==0 && $datas['qq_id']==0) return;
$resa ='';
$resb ='';
$resa = $this->select_third(array("user_id"=>$datas['user_id']));
$temp =array(
"user_id"=>$datas['user_id'],
"sina_id"=>$resa['sina_id']!=0 ? $resa['sina_id'] : $datas['sina_id'],
"qq_id" => $resa['qq_id']!=0 ? $resa['qq_id'] : $datas['qq_id'],
);
if($resa){
$resb = $this->db->update($this->third, $temp,array("user_id"=>$datas['user_id']));
}else{
$resb = $this->db->insert($this->third,$temp);
}
if($resb) {
$this->session->unset_userdata('sina_id');
$this->session->unset_userdata('qq_id');
}
return $resb;
}
}
libraries/tencent/oauth.php在下载附件中
新浪配置文件
application/config/sina_conf.php
<?php
$config["sina_conf"] = array( //测试机
"App_Key" => '1498005339',
"App_Secret" =>'f1c6277a38b39f764c76a1190750a6dc',
"WB_CALLBACK_URL" => 'http://.../callback.php'
);
根目录下的回调地址 callback.php
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
//新浪微博登录回调入口文件,将路径转移到login/callback方法里,并将code值传过去
$code ='';
$url = '';
$str ='';
$code = $_REQUEST['code'];
$url = "/login/callback";
$str = "<!doctype html>
<html>
<head>
<meta charset=\"UTF-8\">
<title>自动跳转</title>
</head>
<body>";
$str .="<form action=\"{$url}\" method=\"post\" id=\"form\" autocomplete='off'>";
$str .="<input type='hidden' name='code' value='{$code}'>";
$str .="</form>
</body>
</html>
<script type=\"text/javascript\">
document.getElementById('form').submit();
</script>";
echo $str;
请求的方法
//流程原理:
// 1.通过code获得access_token通过授权,并获取用户的信息(包括用户u_id)
// 2.查询第三方登录表,如果存在用户id,查询用户表,如果邮箱已经激活,就直接登录,如果没有激活,提示用户去邮箱激活帐号
// 3.查询第三方登录表,如果不存在用户id,分2种情况,一:用户在平台已经有帐号了,这时需要把平台user_reg用户id绑定到第三方登录表,然后就让客户登录
// 二:如果用户在平台没有帐号,跳转至注册页面注册,注册的同时,信息写入uer_reg表,同时也把用户id写入第三方登录表进行绑定
public function callback(){
header("content-type: text/html; charset=utf-8");
$this->load->model("user_reg_model","user_reg");
$code = $_REQUEST['code'];//code值由入口文件callback.php传过来
$arr =array();
$arr = $this->third->sina_callback($code);//通过授权并获取用户信息(包括u_id)
$res = $this->third->select_third(array("sina_id"=>$arr['id']));
if(!empty($res)){
$user_info = $this->user_reg->user_detect(array("id"=>$res['user_id']));
if($user_info['status']){
echo "<script>alert('您登陆的账号还未激活');location='/login/index';</script>";die();
}
$datas = $this->third->select_user_name($arr['id']);
// echo "<pre>";print_r($datas);die();
$uname = $datas['username'];
$password = $datas['password'];
$this->load->model("login_model","login");
$this->login->validation($uname,$password);
echo "<script>alert('登录成功!');location='/user_center'</script>";die();
}else{
$this->session->set_userdata('sina_id',$arr['id']);
echo "<script>if(!confirm('是否在平台注册过用户?')){location='/register/index'}else{location='/login'};</script>";
}
}
- libraries.tar.gz (23.8 KB)
- 下载次数: 27
发表评论
-
phpimageeditor 修改后自用
2015-03-23 16:31 618下载组件phpimageeditor; $ vim phpi ... -
authcode加密解密
2015-03-02 00:14 1409function authcode_config($strin ... -
javascript checebox 全选与反选
2015-01-21 09:34 774// .checkzeny是checkbox标签类 sele ... -
数组与对象的转换
2014-05-29 00:04 584//php 对象到数组转换 private funct ... -
数组递归方法
2014-05-29 00:02 931$items = array( 1 => arr ...
相关推荐
本项目是基于ThinkPHP框架实现的一个简单示例,用于演示如何集成微信、微博和QQ这三大主流社交平台的第三方登录功能。 首先,我们要了解ThinkPHP框架。ThinkPHP是一款国内广泛使用的开源PHP框架,基于MVC(Model-...
1. **OAuth2.0授权协议**:QQ第三方登录基于OAuth2.0授权框架,该协议允许用户在不分享其密码的情况下,授权第三方应用访问其在QQ平台上的部分信息。OAuth2.0提供了安全的授权方式,使得开发者能够为用户提供无缝的...
本主题将详细介绍如何实现第三方登录功能,特别是基于C#的MVC框架,同时也会提及PHP和Java的实现方案。 首先,让我们从概念开始。第三方登录(OAuth)是一种授权协议,允许用户授权第三方应用访问其在特定服务提供...
PHP 第三方登录授权 SDK,集成了QQ、微信、微博、Github等常用接口。 PHP 第三方登录授权 SDK,集成了QQ、微信、微博、Github等常用接口。 PHP 第三方登录授权 SDK,集成了QQ、微信、微博、Github等常用接口。 ...
本篇文章将详细探讨如何在.NET框架下,使用C#语言实现微信和QQ的第三方登录功能。 首先,我们需要理解OAuth 2.0授权框架,这是大多数第三方登录服务的基础。OAuth 2.0允许用户将特定权限授予第三方应用,而无需分享...
第三方登录通常基于OAuth(开放授权)协议,QQ开放平台提供了OAuth2.0的接口。开发者需要在QQ开放平台上注册应用,获取AppID和AppKey,这两个参数是与QQ服务器进行通信的关键。 1. **申请QQ开放平台API** - 首先,...
开发者需要根据ECSHOP的开发文档和这个登录包的指导,将这些第三方登录服务集成到自己的ECSHOP系统中。集成过程可能涉及前端界面的修改,后端逻辑的编写,以及与第三方API的交互。为了确保安全,开发者还需要处理好...
第三方登录(QQ空间+新浪微博)
本Demo主要展示了如何在Android应用中集成QQ、微信、微博的第三方登录服务,实现用户一键授权登录。 首先,你需要了解ShareSDK,这是一个由MobTech提供的社会化分享组件,它支持包括QQ、微信、微博在内的多种社交...
在.NET框架下,开发者可以通过这个接口实现用户通过他们的QQ账号快速登录到自己的应用或者网站,提升用户体验,同时利用QQ社交网络的优势来扩大用户基础。 在.NET环境中,实现QQ第三方登录通常包括以下几个关键步骤...
第三方登录基于OAuth(开放授权)协议,这是一种授权机制,允许用户将应用A授权给应用B,以便应用B能获取用户在应用A上的部分信息,但不需知道用户的登录凭证。OAuth提供了安全的接口,让应用之间可以进行授权交互...
第三方登录(QQ空间+新浪微博).zip项目安卓应用源码下载第三方登录(QQ空间+新浪微博).zip项目安卓应用源码下载 1.适合学生毕业设计研究参考 2.适合个人学习研究参考 3.适合公司开发项目技术参考
第三方登录(QQ空间+新浪微博).zip安卓程序项目源码资源下载第三方登录(QQ空间+新浪微博).zip安卓程序项目源码资源下载 1.适合学生做毕业设计用 2.适合程序员学习研究用 3.适合小公司换皮做新项目用
8. **模板引擎**:虽然CI默认不包含模板引擎,但可以轻松集成第三方模板系统,如Twig或Smarty。 **CI框架的安装与配置** 安装CI框架通常涉及以下步骤: 1. 下载最新版本的CodeIgniter压缩包。 2. 解压到服务器的...
THINKPHP最全第三方登录(包括腾讯QQ、微信、新浪微博、Github、淘宝网、百度、搜狐微博、人人、360、网易等等) 使用方式: 1、使用命名空间 use Org\ThinkSDK\ThinkOauth; 2、设置三方登录的类别并赋予一个变量 $...
本压缩包中的资源主要涉及到了新浪、腾讯和人人网这三家社交媒体平台的第三方登录实现。以下将详细介绍这些知识点: 1. **第三方登录的概念**:第三方登录允许用户使用已有的社交账号(如微信、QQ、微博等)登录...
本文将详细介绍“新浪微博第三方登录demo”的核心概念、操作流程以及实现步骤。 ### 1. 第三方登录的概念 第三方登录,也称为社交登录,允许用户使用他们在社交媒体平台上(如微博、微信、QQ等)已有的账号来注册或...
QQ第三方登录基于OAuth2协议,这是一个授权框架,允许第三方应用获取用户在QQ平台上的信息,但不直接存储用户的用户名和密码。OAuth2的核心概念包括授权码、访问令牌和刷新令牌,它们确保了数据安全性和用户隐私。 ...
无论是QQ空间还是新浪微博,它们的登录流程都基于OAuth 2.0标准,这是一个安全的授权框架,允许第三方应用代表用户获取有限的访问权限。 - 授权码 Grant Type:用户同意后,服务器返回一个授权码,应用通过这个码...