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

本文标签: 第三方WAPqq