thinkphp-social 适用于 thinkphp5.1 thinkphp6.0 的社会化登录开源项目

我要开发同款
匿名用户2019年12月09日
151阅读

技术信息

开源地址
https://github.com/liliuwei/thinkphp-social
授权协议
Apache

作品详情

thikphp-social

适用于thikphp5.1thikphp6.0的社会化登录扩展

目前已支持:QQ、微信、新浪、百度、Gitee、Github、Oschia、Google、Facebook、淘宝

安装(扩展包)composerrequireliliuwei/thikphp-social配置Cofig信息//安装之后会在cofig目录里自动生成social.php配置文件<?phpretur[//腾讯QQ登录配置'qq'=>['app_key'=>'*******',//应用注册成功后分配的APPID'app_secret'=>'*******',//应用注册成功后分配的KEY'callback'=>'https://www.youquaya.com/oauth/callback/type/qq',//应用回调地址],//微信扫码登录配置'weixi'=>['app_key'=>'*******',//应用注册成功后分配的APPID'app_secret'=>'*******',//应用注册成功后分配的KEY'callback'=>'https://www.youquaya.com/oauth/callback/type/weixi',//应用回调地址],];用法示例<ahref="{:url('Oauth/logi',['type'=>'qq'])}">QQ登录</a><ahref="{:url('Oauth/logi',['type'=>'sia'])}">新浪微博登录</a><ahref="{:url('Oauth/logi',['type'=>'weixi'])}">微信登录</a><ahref="{:url('Oauth/logi',['type'=>'baidu'])}">百度登录</a><ahref="{:url('Oauth/logi',['type'=>'gitee'])}">gitee登录</a><ahref="{:url('Oauth/logi',['type'=>'github'])}">github登录</a><ahref="{:url('Oauth/logi',['type'=>'oschaia'])}">oschaia登录</a><ahref="{:url('Oauth/logi',['type'=>'google'])}">google登录</a><ahref="{:url('Oauth/logi',['type'=>'facebook'])}">facebook登录</a><ahref="{:url('Oauth/logi',['type'=>'taobao'])}">淘宝登录</a>//设置路由Route::get('oauth/callback','idex/oauth/callback');<?phpamespaceapp\idex\cotroller;usethik\Cotroller;classOauthextedsCotroller{//登录地址publicfuctiologi($type=ull){if($type==ull){$this->error('参数错误');}//获取对象实例$ss=\liliuwei\social\Oauth::getIstace($type);//跳转到授权页面$this->redirect($ss->getRequestCodeURL());}//授权回调地址publicfuctiocallback($type=ull,$code=ull){if($type==ull||$code==ull){$this->error('参数错误');}$ss=\liliuwei\social\Oauth::getIstace($type);//获取TOKEN$toke=$ss->getAccessToke($code);//获取当前第三方登录用户信息if(is_array($toke)){$user_ifo=\liliuwei\social\GetIfo::getIstace($type,$toke);dump($user_ifo);//获取第三方用户资料$ss->opeid();//统一使用$ss->opeid()获取opeid//$ss->uioid();//QQ和微信、淘宝可以获取uioiddump($ss->opeid());echo'登录成功!!';echo'正在持续开发中,敬请期待!!';}else{echo"获取第三方用户的基本信息失败";}}}

功能介绍

thinkphp-social 适用于thinkphp5.1 thinkphp6.0的社会化登录扩展 目前已支持:QQ、微信、新浪、百度、Gitee、Github、Oschina、Google、...

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论