Loading...

H5使用微信登录

原创文章4年前 (2020)发布 fdadmin
5,755 0 0

流程:
① 请求微信接口(携带指定参数appid,scope等。及一个回调地址redirect_uri)
② 微信收到请求后会跳转到回调地址redirect_uri,并在该回调地址上携带相关回调参数
③ 提取相关回调参数传给后台即可

1、获取网页授权

(官方文档:https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_webpage_authorization.html)

wxLogin(){     // ① 
    window.location.href=`https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx666b1e66bbd57c4c&redirect_uri=http%3a%2f%2fm.test.demo.com%2fuser%2fwxLogin&response_type=code&scope=snsapi_userinfo&state=mlogin#wechat_redirect`
    },
© 版权声明

相关文章

暂无评论

暂无评论...