Appearance
微信公众号跳转h5
参考文档:
公众号 -> 微信网页开发 -> 网页授权 https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_webpage_authorization.html
redirect_uri:使用 urlEncode 对链接进行处理;
每次用户授权带上的code不一样,code只能使用一次,5分钟未被使用自动过期。
举个栗子:
h5页面接受参数:
const url = new URL(document.location.href)
let code = url.searchParams.get('code')
let state = url.searchParams.get('state') // 2