微信网页获取openid

2021-07-06 06:39:23
25,014

第三方开放平台微信网页接入说明

应用场景:微信网页获取openid,即微信用户通过菜单网页访问时可作为已知用户,获取头像及昵称,非匿名用户,保障了沟通的连续性。

 3.png

微信网页获取微信用户前提条件:

1.微信网页接入入口为微信公众号下方的自定义菜单

2.对应的微信公众号需要绑定到在第三方开放平台(微信接入页面扫描绑定,需要有网页服务权限、用户管理权限)

        

地址:

https://open.weixin.qq.com/connect/oauth2/authorize?appid={appid}&redirect_uri={redirect_uri}&response_type=code&scope=snsapi_userinfo&state=STATE&component_appid={component_appid}#wechat_redirect

 

参数说明:

appid:微信公众号appid(接入方替换对应的appid)

redirect_uri:重定向地址,需要urlencode (配置网页接入的直连url

component_appid:第三方平台appId(固定值wx9f7ff9894af71c05)

 

检查:

判断地址是否有效,在微信中点开该地址,是否能跳转到在线客服页面

 

操作:

在微信公众号微信后台,替换微信公众号的对应自定义菜单地址

 

微信官网参考地址:https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Before_Develop/Official_Accounts/official_account_website_authorization.html

 

 

样例:

https://open.weixin.qq.com/connect/oauth2/authorize?appid=xxxxxxxxxx&redirect_uri=https%3A%2F%2Fintelcc-user.icsoc.net%2F%3FchannelKey%3Dxxxxxxxx%26init%3D1&response_type=code&scope=snsapi_userinfo&state=STATE&component_appid=wx9f7ff9894af71c05#wechat_redirect

 

 

 

Url urlencode :样例

打开百度搜索Url urlencode在线工具

1.png

在此页面进行rulEncode   将我们需要的直连的rul复制到上面进行解码

2.png

将转码结果复制到redirect_uri:‘转码结果’进行组合

该文章对您是否有用?