Check whether the
allowPrefix you entered when applying for the temporary key are correct.
cos.putObject(), but the
actiondoes not contain name/cos:PutObject, then there is no
putObjectpermission, resulting in the error 403.
1.jpg, but the
allowPrefixis entered as
test/*(only allowing operations on the
test/*path), then there is no operation permission for the corresponding path, resulting in the error 403.
allowPrefix are correct, see Generating and Using Temporary Keys and 403 Error for COS Access.
Field description: STS SDKs for different languages use different fields for
allowPrefix, such as
allowPrefixes in the STS Java SDK. Be sure to check the examples in the STS SDK.
When the SDK is instantiated,
ForcePathStyle:true can be used to enable suffixed request, and then only the URL of the real request is needed, which is in the following format:
When a suffixed request is signed, the bucket name
/<bucketname-appid> will also be used in the signature calculation.
wx.downloadFileto download the image and get the temporary path.
wx.saveImageToPhotosAlbumto save the image to the album.
COS currently supports only WeChat mini programs, but WeChat mini programs do not interconnect with QQ mini programs. Therefore, the Mini Program SDK cannot be used.
getAuthorizationfunction do when mini programs use cos-wx-sdk-v5 to upload files to buckets?
The backend uses the
getAuthorization function in the Mini Program SDK to get a temporary key and sends it to the frontend for signature calculation. Then, you can perform operations such as upload and deletion on the files according to the signature calculation result. We recommend you use a temporary key to prevent disclosure of your key. For more information, see Getting Started.