7

如何解决腾讯云短信SDK签名格式错误或者签名未审批

 3 years ago
source link: https://www.myfreax.com/signature-format-is-incorrect-or-signature-is-not-approved/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
更新于 2021/09/2 |  创建于 2021/09/2

如何解决腾讯云短信SDK签名格式错误或者签名未审批

你可能会遇到下面的类似的错误signature format is incorrect or signature is not approved,签名格式错误或者签名未审批。

这是因为上面的sign签名你没有写上。虽然sign签名不是必填项,但是如果是国内短信必须填写,必须填写,必须填写,说三遍,文档太坑。

    /**
      * 短信签名内容,使用 UTF-8 编码,必须填写已审核通过的签名,例如:腾讯云,签名信息可登录 [短信控制台](https://console.cloud.tencent.com/smsv2) 查看。
<dx-alert infotype="notice" title="注意">国内短信为必填参数。</dx-alert>
SignName?: string;
      */
    
   
const SmsClient = sms.v20210111.Client;
  const clientConfig = {
    credential: {
      secretId: "AKIDcGsQwQqBRhsyzx",
      secretKey: "Qlz6Vq5DLPOG3k",
    },
    region: "ap-guangzhou",
    profile: {
      httpProfile: {
        endpoint: "sms.tencentcloudapi.com",
      },
    },
  };
  const client = new SmsClient(clientConfig);
  const verifyCode = String(Math.random()).replace("0.", "").slice(0, 6);
  const res = await client.SendSms({
    SignName: "签名内容,一般是你公司的问题名称",
    SmsSdkAppId: "1400567689",
    PhoneNumberSet: ["你的电话号码"],
    TemplateParamSet: ["随机验证码"],
    TemplateId: "1101454",
  });
  console.info(res);

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK