admin管理员组文章数量:1558102
一、qq登录
1、申请,创建应用
https://connect.qq/
输入相关信息,主要的网站域名和回调地址,回调地址新改的规则是要很完整填写
获取到app id和app key
2、查看qq登录文档
http://wiki.open.qq/wiki/website/%E6%94%BE%E7%BD%AE%E2%80%9CQQ%E7%99%BB%E5%BD%95%E2%80%9D%E6%8C%89%E9%92%AE_OAuth2.0
1)qq按钮
<a href="#" οnclick='qqLogin()'> <img src="img/qq_login.png"></a>
2)获取code
PC网站: https://graph.qq/oauth2.0/authorize (官网文档虽然是wap,但调用wap的时候显示网页不存在,所以选择了pc)
$scope. qqLogin = function(){ $scope. Redirect_uri_qq = encodeURIComponent( "https://.../login.html"); location. href= "https://graph.qq/oauth2.0/authorize?client_id=123456&response_type=code&scope=get_user_info&state="+ $scope. state+ "&redirect_uri="+ $scope. Redirect_uri_qq; }
3) token和openId通过后台获取
二、微信登录
1)获取code
$scope. wechatLogin = function(){ //微信授权,获取code $scope. Redirect_uri = encodeURIComponent( "https://code.html?lastUrl="+ $scope. lastUrlLink); location. href= "https://open.weixin.qq/connect/oauth2/authorize?appid=123456&redirect_uri="+ $scope. Redirect_uri+ "&response_type=code&scope=snsapi_userinfo&state="+ $scope. state_wx+ "#wechat_redirect"; } 2)其他同qq版权声明:本文标题:wap接入微信、qq第三方登录 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dongtai/1727388279a1112465.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论