调用云函数获取token失败?error message Unexpected token *
发布于 6 年前 作者 yan13 8153 次浏览 来自 官方Issues
const cloud = require('wx-server-sdk')
const got=require('got')

let appid='***';//我手动隐藏了
let sercet='****';//我手动隐藏了

let batchDownloadFileUrl='https://api.weixin.qq.com/tcb/batchdownloadfile?access_token='
let tokenUrl='https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='+appid+'&secret='+sercet

cloud.init()

// 云函数入口函数
exports.main = async (event, context) => {
  let tokenResponse =await got(tokenUrl)
  let token=JSON.parse(tokenResponse).assess_token;
  return token;
  // let batchUrlResponse=await got(batchDownloadFileUrl+token),

我这照着视频没写两句就报错了- -|||我和老师操作一样啊,求大神帮忙看看,谢谢.

1 回复

npm install got@9 --save 我记得是不是给你说过

回到顶部