首页 技术 正文
技术 2022年11月20日
0 收藏 628 点赞 3,456 浏览 1427 个字

1.当从第三方软件需要分享到微信的时候 需要给授权处理才能获得微信信息 比如 nickname 等昵称图像等

从第三方登陆跳转到微信分享页需要 shareurl = http://open.weixin.qq.com/commect/oauth2/….+redirect_uri=…..+…..   //redirect_uri  是回调地址,

这个页面会挑战到微信授权页面当你点击授权登陆的时候就会跳转到奥redirect_uri 地址上去.

如果授权成功 跳转的地址是 redirect_uri/?code=CODE&state=STATE CODE和 STATE 是成功后带上的参数

然后到了微信带有code参数的页面 ,需要分享的时候需要 向https://api.weixin.qq.com/sns/oauth2/access_token?appid=….code 等参数 从这个接口可以获得accesss_token

然后用accesss_token 向 https://api.weixin.qq.com/sns/userinfo?access_token=… openid=….&lang=zh 值 就可以获得到 成功的时候可以获取到一下信{

   "openid":" OPENID",
" nickname": NICKNAME,
"sex":"1",
"province":"PROVINCE"
"city":"CITY",
"country":"COUNTRY",
"headimgurl": "http://wx.qlogo.cn/mmopen/g3MonUZtNHkdmzicIlibx6iaFqAc56vxLSUfpb6n5WKSYVY0ChQKkiaJSgQ1dZuTOgvLLrhJbERQQ4eMsv84eavHiaiceqxibJxCfHe/46",
"privilege":[
"PRIVILEGE1"
"PRIVILEGE2"
],
"unionid": "o6_bmasdasdsad6_2sgVt7hMZOPfL"
}
2.在第三方软件上如何分享到微信,朋友圈,qq,微博等
var api = new API(appid,secret);var param = {
  debug : false,  
  jsApiList : ['onMenuShareTimeline', 'onMenuShareAppMessage','showOptionMenu','onMenuShareQZone','onMenuShareWeibo','onMenuShareQQ'],  
  url : url
};
api.getJsConfig(param, function(err, result) {  
  res.end(JSON.stringify(result));  
  console.log(JSON.stringify(result));
});
前端js 代码需要
wx.config(result)
wx.ready({
  wx.checkApi ({
    jsApiList :[],
    success : function(res){}
  });
  wx.onMcnushareTineline({ //分享到朋友圈
    title:
    link:
    imgUrl:
    success:
    cancel
  });
  ...
  ...
  ...
  ...
  wx.error(function(){
  })
})
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,000
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,512
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,358
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,141
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,771
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,849