1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > 微信公众号和微信小程序获取OPENID的方法

微信公众号和微信小程序获取OPENID的方法

时间:2020-01-19 12:25:33

相关推荐

微信公众号和微信小程序获取OPENID的方法

无论是微信小程序还是微信公众号获取OPENID都需要先获取code

获取code

String url = "https://open./connect/oauth2/authorize?appid=" + ticketWxConfig.getCustomAppId() +"&redirect_uri=" + URLEncoder.encode(redirect_uri, UTF_8) +"&response_type=code&scope=snsapi_base&state=STATE&connect_redirect=1#wechat_redirect";

微信公众号获取OPENID

String getAccessTokenUrl = "https://api./sns/oauth2/access_token?"+ "appid=" + wxConfig.getCustomAppId()+ "&secret=" + wxConfig.getCustomSecret()+ "&code=" + code + "&grant_type=authorization_code";

微信小程序获取OPENID

String url = "https://api./sns/jscode2session?appid=" +wxConfig.getAppletsAppId() +"&secret=" + wxConfig.getAppletsSecret() +"&js_code=" + code + "&grant_type=authorization_code";

微信官方文档

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。