关于云开发小程序获取公众号access_token问题?
发布于 5 年前 作者 kongjuan 13377 次浏览 来自 官方Issues

云开发小程序 出现了这种错误

网上版本都试了一遍,都不太成功,想问问原因是什么?

1 回复

那你肯定需要的是这段代码:换上公众号的appid和secret

const rp = require('request-promise')

exports.main = async (event, context) => {

  options = {
    uri: 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' + event.AppID + '&secret=' + event.AppSecret + '',
    json: true
  }
  return await rp(options)
}
回到顶部