微信小程序wx.request请求header中携带token值

微信小程序使用接口鉴权时要用到jwt   token值需要放在header中

在wx.request请求中需要将token值放在header信息中

    wx.request({
      url: 'http://www.tp.com/api.php/show',
      header:{
        //   wx.getStorageSync('token') 从缓存中取出token值
        "authorization":"bearer"+wx.getStorageSync('token')
      },
      success:(e)=>{
      
      },
)}
posted @ 2023-08-26 14:54  哎呀呀哈  阅读(213)  评论(0)    收藏  举报  来源