apiClould微信三方登录,qq三方登录
三方登录需要在config.xml文件中配置一下,res文件下需要新建一个key.xml文件中也需要配置,请点击链接查看详情
微信:https://docs.apicloud.com/Client-API/Open-SDK/wx
QQ:https://docs.apicloud.com/Client-API/Open-SDK/qq
微博:https://docs.apicloud.com/Client-API/Open-SDK/weibo
微信三方登录:
wxlogin: function() {
var this_obj = this;
var wx = api.require('wx');
wx.isInstalled(function(ret, err) {
if (ret.installed) {
wx.auth({}, function(coderet, err) {
if (coderet.status) {
wx.getToken({
code: coderet.code,
}, function(tokenret, err) {
if (tokenret.status) {
wx.getUserInfo({
accessToken: tokenret.accessToken,
openId: tokenret.openId,
}, function(userret, err) {
if (userret.status) {
var user_info = {
nickname: userret.nickname,
headimgurl: userret.headimgurl,
sex: userret.sex
}
var data = {
open_id: userret.openid,
user_info: JSON.stringify(user_info),
unionid: userret.unionid,
type: '微信',
source: 'APP'
}
var u_url = "/LoginBak/login";
common_ajax(u_url, data, function(ret) {
this_obj.token = ret.info.token;
this_obj.binding_status = ret.info.binding_status;
this_obj.user_code = ret.info.user_code;
if (this_obj.binding_status == false) {
this_obj.show_bind = true;
} else {
setToken(ret.info.token);
after_login();
huanxin_loding(ret.info.token)
}
}, function(ret) {
api.toast({
msg: res.info
});
});
} else {
api.toast({
msg: '获取个人用户信息失败!'
});
}
});
} else {
api.toast({
msg: '获取accesstoken失败!'
});
}
});
} else {
api.toast({
msg: '获取code失败!'
});
}
});
} else {
api.toast({
msg: '您还未未安装微信客户端!'
});
}
});
},
QQ三方登录
qqlogin: function() {
var this_obj = this;
var qq = api.require('qq');
qq.installed(function(ret, err) {
if (ret.status) {
qq.login(function(tokenret, err) {
if (tokenret.status) {
qq.getUserInfo(function(userret, err) {
if (userret.status) {
var user_info = {
nickname: userret.info.nickname,
headimgurl: userret.info.figureurl_qq_2,
sex: userret.info.gender
}
var data = {
open_id: tokenret.openId,
user_info: JSON.stringify(user_info),
type: 'qq',
source: 'APP'
}
var u_url = "/LoginBak/login";
common_ajax(u_url, data, function(ret) {
this_obj.token = ret.info.token;
this_obj.binding_status = ret.info.binding_status;
this_obj.user_code = ret.info.user_code;
if (this_obj.binding_status == false) {
this_obj.show_bind = true;
} else {
setToken(ret.info.token);
after_login();
huanxin_loding(ret.info.token)
}
}, function(ret) {
api.toast({
msg: res.info
});
});
}
});
}
});
} else {
api.toast({
msg: '您还没有没有安装qq客户端'
});
}
});
},
微博三方登录
sinalogin: function() {
var this_obj = this;
var weibo = api.require('weibo');
weibo.isInstalled(
function(ret) {
if (ret.status) {
weibo.auth({
apiKey: ,
registUrl: 'http://apicloud.com'
},
function(tokenret, err) {
alert(JSON.stringify(tokenret))
if (tokenret.status) {
weibo.getUserInfo({
token: tokenret.token,
userId: tokenret.userId
}, function(userret, err) {
if (userret.status) {
var user_info = {
nickname: userret.userInfo.screen_name,
headimgurl: userret.userInfo.profile_image_url
}
var data = {
user_info: JSON.stringify(user_info),
open_id: userret.userInfo.id,
type: '微博',
source: 'APP'
}
var u_url = "/LoginBak/login";
common_ajax(u_url, data, function(ret) {
// alert(222)
this_obj.token = ret.info.token;
this_obj.binding_status = ret.info.binding_status;
this_obj.user_code = ret.info.user_code;
if (this_obj.binding_status == false) {
this_obj.show_bind = true;
} else {
setToken(ret.info.token);
after_login();
huanxin_loding(ret.info.token)
}
}, function(ret) {
api.toast({
msg: res.info
});
});
}
});
} else {
api.toast({
msg: "获取token失败"
});
}
});
} else {
api.toast({
msg: "您尚未安装新浪微博客户端"
});
}
}
);
}
apiClould微信三方登录,qq三方登录的更多相关文章
- PHP实现qq三方登录
除了qq第三方登录外.还有微博,微信等第三方登录 qq第三方登录,遵循oauth2.0协议 这里是说明http://www.cnblogs.com/yx520zhao/p/6616686.html q ...
- Badboy运行脚本 - 登录QQ邮箱,编写及发送邮件
参考: http://leafwf.blog.51cto.com/872759/1112128 http://www.51testing.com/html/00/130600-1367743.html ...
- 如何本地测试例如QQ登录等第三方接口
前言:现在基本是个网站就会集成第三方的一些接口,比如QQ登录.分享等等.但是在开发的时候,尤其是没有这方面经验的开发人员来说,调试流程时会显得迷茫,不知道怎么调试.这里就个人的这方面学习摸索做一个总结 ...
- QQ三方登录
申请了十天,最终通过了审核,能够上线了,事实上申请的第一天,站点的qq登录已经做好了,而且能够用測试帐号登录,但提交审核后,总是通只是,提示:您的站点审核未通过.原因是"未放置QQ登录but ...
- QQ三方登录步骤详解
首先,登录QQ互联:http://connect.qq.com/intro/login ,注册成为开发者 选择申请加入,并创建你的应用. 创建成功后可以获取到appid和appkey 在网站的主页引 ...
- 没错,用三方 Github 做授权登录就是这么简单!(OAuth2.0实战)
本文收录在个人博客:www.chengxy-nds.top,技术资源共享. 上一篇<OAuth2.0 的四种授权方式>文末说过,后续要来一波OAuth2.0实战,耽误了几天今儿终于补上了. ...
- springboot shiro和freemarker集成之权限控制完全参考手册(跳过认证,登录由三方验证,全网首发)
本文主要考虑单点登录场景,登录由其他系统负责,业务子系统只使用shiro进行菜单和功能权限校验,登录信息通过token从redis取得,这样登录验证和授权就相互解耦了. 用户.角色.权限进行集中式管理 ...
- dedecms织梦第三方登录插件-QQ登录、微博登录、微信登录
织梦程序集成第三方QQ登录.微博登录.微信登录,获取QQ.微博.微信,并存储至数据库,一键注册为网站会员,不用再次填写绑定信息,方便粘贴用户更强. 织梦第三方登录效果 第三方登录插件特点 1.所有文件 ...
- QQ第三方登录
QQ第三方登录 在Android应用程序的开发过程中,很多时候需要加入用户登录/注册模块.除了自己动手设计登录界面并实现相应功能外,现在还可以借助百度.腾讯等开发者平台提供的第三方账号登录模块.最近研 ...
随机推荐
- Android编译系统中的Android.bp【转】
本文转载自: 转自:http://note.qidong.name/2017/08/android-blueprint/ Android编译系统中的Android.bp.Blueprint与Soong ...
- linux内核中的两个标记GFP_KERNEL和GFP_ATOMIC是用来干什么的?
1. 作用 用来标记分配内核空间内存时的方式 2. 两个标记使用在什么场合? 如果内存不够时,会等待内核释放内存,直到可以分配相应大小的内存,也就意味着会发生阻塞,因此不能使用在中断处理函数中,而GF ...
- 论文笔记之:Heterogeneous Face Attribute Estimation: A Deep Multi-Task Learning Approach
Heterogeneous Face Attribute Estimation: A Deep Multi-Task Learning Approach 2017.11.28 Introductio ...
- Tutorials on training the Skip-thoughts vectors for features extraction of sentence.
Tutorials on training the Skip-thoughts vectors for features extraction of sentence. 1. Send emails ...
- %lld 和 %I64d的区别
参考一个博客的链接:https://blog.csdn.net/thunders01/article/details/38879553
- Java基础 【Math、Random、System、BigInteger、BigDecimal、Date、Calendar等常用类的使用】
学习的这几个类 是日常工作中经常要使用到的类 Math 类包含用于执行基本数序运算的方法,如初等指数.对数.平方根和 三角函数. 成员方法 1.public static int abs(int a ...
- angularjs启动项目报ERROR in AppModule is not an NgModule解决方法
这主要是ts编译器版本问题,一般是因为ts编译器版本过高导致. 解决方式: npm uninstall -g typescript npm install -g typescript tsc -v 查 ...
- Lintcode35-Reverse Linked List-Easy
35. Reverse Linked List Reverse a linked list. Example Example1:For linked list 1->2->3, the r ...
- nodejs的dependency.md
dependency和devDependency的区别 package-a --- package-b (dependency) --- | --- package-c (devDependency) ...
- HTML的Doctype
1. <!DOCTYPE> 声明位于文档中的最前面,处于 <html> 标签之前.告知浏览器的解析器,用什么文档类型 规范来解析这个文档. 2. 严格模式的排版和 JS 运作模 ...