配置好腾讯云账号 下载对应SDK引入使用,这里提供实践代码。
let COS = require('./utils/cos-wx-sdk-v5');
//签名生成配置数,可自行生成,或者后台处理好给你
// 初始化cos 后台配置参数
// new Cos sdk 实例
var cos = new COS({
getAuthorization (options, callback) {
App.post('api/oss/authorization',JSON.stringify(api_data)).then((res)=>{
let credentials = res.data;
callback({
TmpSecretId: credentials.tempSecretId,
TmpSecretKey: credentials.tempSecretKey,
XCosSecurityToken: credentials.tempTo