tencentyun / qcloud-cos-sts-sdk

QCloud COS STS SDK for Backend Server
MIT License
200 stars 188 forks source link

go版本SDK接口返回报错 #32

Closed busyfree closed 4 years ago

busyfree commented 4 years ago

直接使用go里面的demo去创建token的

Code: InvalidParameter.GrantOtherResource, Message: [QC_STS] cant grant other resource, RequestId

代码

    opt := &sts.CredentialOptions{
        DurationSeconds: expiredAt,
        Region:          region,
        Policy: &sts.CredentialPolicy{
            Statement: []sts.CredentialPolicyStatement{
                {
                    Action: []string{
                        "name/cos:PostObject",
                        "name/cos:PutObject",
                    },
                    Effect: "allow",
                    Resource: []string{
                                                  // 这里的uid是腾讯云后台的APPID?
                        "qcs::cos:" + region + ":uid/" + uid + ":" + bucket + "/tmp",
                    },
                },
            },
        },
    }