微信小程序 wx.request 获取百度API token

来源:互联网 发布:vrp在线算法 编辑:程序博客网 时间:2024/04/28 16:25


wx.request({        url: "https://aip.baidubce.com/oauth/2.0/token",        data: {          grant_type: "client_credentials",          client_id: config.Config.baiduApiKey,          client_secret: config.Config.baiduApiSecret        },        header:{          "content-type": "application/x-www-form-urlencoded"         },        success:function(res){          console.log(res.data)        }      })


res返回数据例子:

{    "access_token": "1.a6b7dbd428f731035f771b8d15063f61.86400.1292922000-2346678-124328",    "expires_in": 86400,    "refresh_token": "2.385d55f8615fdfd9edb7c4b5ebdc3e39.604800.1293440400-2346678-124328",    "scope": "basic email",    "session_key": "ANXxSNjwQDugf8615OnqeikRMu2bKaXCdlLxn",    "session_secret": "248APxvxjCZ0VEC43EYrvxqaK4oZExMB",}



阅读全文
0 0
原创粉丝点击