这种校验方式几乎是所有社交平台上都在使用的方式, 比如,微信支付,微信登录, 微博登录,微信支付都需要用到

    1. 由前端发起授权链接跳转 ```javascript export function wechatAuth (target) { let redictUrl = WX_OAUTH_HOST + target console.log(‘https://open.weixin.qq.com/connect/oauth2/authorize?appid=‘ + APP_APPID + ‘&redirect_uri=’ + redictUrl + ‘&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect’) window.location.href = ‘https://open.weixin.qq.com/connect/oauth2/authorize?appid=‘ + APP_APPID + ‘&redirect_uri=’ + redictUrl + ‘&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect’ }

    export function xiaoWeiAuth (target, item) { let targetUrl = WX_OAUTH_HOST + target let redict = ‘https://www.yuneryi.com/v2/wechat/login?app_key=‘ + item.key + ‘&sub_mch_id=’ + item.id + ‘&snsapi_userinfo=false&callback=’ + targetUrl window.location.href = redict }

    export function weiboAuth (target) { let targetUrl = WX_OAUTH_HOST + target let clientId = ‘123050457758183’ let redict = ‘https://api.weibo.com/oauth2/authorize?client_id=‘ + clientId + ‘&redirect_uri=’ + targetUrl + ‘&response_type=code’ window.location.href = redict }

    1. 2.在重定向的目标页面会多携带一个参数叫code
    2. ```javascript
    3. if (Helper.isWechat()) {
    4. this.isWxchat = true
    5. if (this.$route.query.code) this.fetchCode(this.$route.query)
    6. }

    3.后端通过code来获取用户的相关平台的信息