調用微信靜默授權接口

    window.location.href="https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appId + "&redirect_uri="
          + encodeURIComponent(configApi.config.api+"live/webSilenceAuth?eventId=" + eventId +'&utm_source=' + utm_source + "&targetUrl=" + encodeURIComponent(localUrl))
          +"&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";

傳遞appid給微信,redirect_uri是授權後重定向的回調鏈接地址, 請使用encodeURIComponent解碼對鏈接進行處理。
這裏的redirect_uri是向後臺請求接口,並且把我想要傳遞給後臺的參數都傳過去。然後後臺再返回東西給前端。
scope=snsapi_base是靜默授權

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章