lucky1213 / aliyun_oss

阿里云 OSS flutter
MIT License
17 stars 12 forks source link

InvalidAccessKeyId #19

Closed realcarlos closed 1 year ago

realcarlos commented 1 year ago

I/flutter ( 3569): I/flutter ( 3569): InvalidAccessKeyId I/flutter ( 3569): The OSS Access Key Id you provided does not exist in our records. The Security Token may be lost to specify that it is a STS Access Id. I/flutter ( 3569): 64DCFBB694C77F3830309BB0 I/flutter ( 3569): paper-data-uat.oss-cn-hangzhou.aliyuncs.com I/flutter ( 3569): STS.NUQrpkhEPr98RDscmwTiUMKdc I/flutter ( 3569): 0002-00000003 I/flutter ( 3569):

这是初始化的代码;

/// 初始化aliyun oss OSSClient.init( endpoint: resp.data.endpoint, bucket: resp.data.bucket, credentials: () { // Or Credentials Config return Future.value(Credentials( accessKeyId: resp.data.accessKeyId, accessKeySecret: resp.data.accessKeySecret, securityToken: resp.data.stsToken )); }, );

这是上传的代码: final object = await OSSClient().putObject( object: OSSImageObject.fromFile(file: File(path)), bucket: state.bucket, // String? endpoint: state.endpoint, // String? );

不明白为什么这里还要设置bucket和endpoint

lucky1213 commented 1 year ago

可以不设置,如果上传时指定则根据指定的bucket和endpoint完成单次上传,大部分情况无需再上传时指定