overtrue / easy-sms

📲 一款满足你的多种发送需求的短信发送组件
MIT License
3.1k stars 542 forks source link

版本v2.01 腾讯云SMS报错:The provided credentials could not be validated. Please check your signature is correct. #313

Closed yingquanh closed 2 years ago

overtrue commented 2 years ago

@kvnZero 麻烦看一下哦

overtrue commented 2 years ago

@hyq-code 我刚才用下面的代码测试了,没问题,应该是你的账号凭证填错了:

<?php

require __DIR__ . '/vendor/autoload.php';

$sms = new Overtrue\EasySms\EasySms([
    // HTTP 请求的超时时间(秒)
    'timeout' => 5.0,

    // 默认发送配置
    'default' => [
        // 网关调用策略,默认:顺序调用
        'strategy' => \Overtrue\EasySms\Strategies\OrderStrategy::class,

        // 默认可用的发送网关
        'gateways' => [
            'qcloud',
        ],
    ],
    // 可用的网关配置
    'gateways' => [
        'errorlog' => [
            'file' => '/tmp/easy-sms.log',
        ],
        'qcloud' => [
            'sdk_app_id' => '1400xxxxxx', // SDK APP ID
            'secret_id' => 'AKIDZ1GG1XoqdBWfZGivtfEahZxxxxxxxx', // SECRET ID
            'secret_key' => 'qSs53nPoytZzCAvcTBi8xxxxxxxxxx', // SECRET KEY
            'sign_name' => '腾讯CoDesign', // 短信签名
        ],
    ],
]);

try {
    $sms->send(手机号码, [
        'template' => 1109581, // 模板ID
        'data' => [ 'a', 'b', 'c' ],
    ]);

    echo 'success';
} catch (\Throwable $th) {
    var_dump($th->getExceptions());
}
kvnZero commented 2 years ago

(貌似艾特我, github不会在右上角角标亮标 今天看邮箱才发现

是否SDK APP ID,SECRET ID,SECRET KEY填写错误呢? 自己的项目已经运行一段时间都是正常的呢

overtrue commented 2 years ago

@kvnZero 应该是这三个参数填错了,我昨天从0开始申请的账号测试过的哈。

RyanTuVu commented 2 years ago

我也在我的项目上运行了一段时间了, 除了之前模板ID的问题,其他好像没什么问题。

yingquanh commented 2 years ago

版本参数不同问题,之前安装了 v1.3.3 版本