返回的error code[图片]
调用百度AI动物识别功能开发者工具上调试没问题,真机调试返回error_code, 不知道怎么解决?返回error code,官方文档说是因为token过期,不知道怎么解决或改代码 const grant_type = 'client_credentials' const client_id = xxxxxx' const client_secret = 'dxxxxxxx' var token = null var base64 = null var apiUrl = null Page({ data: { imageUrl: "", message: '欢迎使用动物识别', load_logo: 'waiting', load_title: "等待上传图片", load_message: " 请上传图片", btn_enable:true, test:22 }, onReady: function(res) { // get access_token from BaiDu API wx.request({ url: 'https://aip.baidubce.com/oauth/2.0/token?grant_type=' + grant_type + '&client_id=' + client_id + '&client_secret=' + client_secret, method: 'POST', success: function (res) { console.log('Request successful !') // console.log(res.data) token = res.data.access_token; console.log('My token is : ' + token); }, fail: function (res) { console.log('Fail to request !') console.log(res) } }) },
2023-03-17