overtrue / laravel-qcloud-content-audit

腾讯云内容安全(文字图片内容审核)服务
MIT License
44 stars 5 forks source link

提示 You are not authorized to perform this operation. #12

Open gyp719 opened 1 year ago

gyp719 commented 1 year ago

使用同一个账号密钥 用官方包 "tencentcloud/tencentcloud-sdk-php": "^3.0", 可以正常识别

使用 overtrue/laravel-qcloud-content-audit

image

gyp719 commented 1 year ago

$res = \Overtrue\LaravelQcs\Tms::mask('这是敏感内容哦');

dd($res) ;

问下, 是我哪里设置的不对吗? 可以指导下?

overtrue commented 1 year ago

贴代码

gyp719 commented 1 year ago

安装成功后, 在 services.php 文件设置 密钥,

` // 文字识别服务 'tms' => [ 'secret_id' => env('TMS_SECRET_ID', ''), 'secret_key' => env('TMS_SECRET_KEY', ''), // 'endpoint' => env('TMS_ENDPOINT', 'tms.tencentcloudapi.com'), // // 可选,默认使用腾讯云默认策略 // 'biz_type' => env('TMS_BIZ_TYPE'), // 可选,开启后跳过 tms 识别/打码功能 // 'dry' => env('TMS_DRY', true), ],

// 图片审核/识别服务
'ims' => [
    'secret_id' => env('IMS_SECRET_ID'),
    'secret_key' => env('IMS_SECRET_KEY'),
    'endpoint' => env('IMS_ENDPOINT'),

    // 可选,默认使用腾讯云默认策略
    'biz_type' => env('IMS_BIZ_TYPE'),
    // 可选,开启后跳过 ims 识别功能
    'dry' => env('IMS_DRY', false),
],`

调用使用

    $res = \Overtrue\LaravelQcs\Tms::mask('这是敏感内容哦');

    dd($res) ;
overtrue commented 1 year ago

这个报错是腾讯云报的,就是你的账号没有添加 cam 相关授权,所以检查你的 IMS_SECRET_ID 对应的权限。