我需要将文件上传到AWS S3。我只有accessKey,secretKey和令牌,我都是从第三方服务器获得的。并且在另一个具有相同凭据的操作系统上也能很好地工作
mClient = new AmazonS3Client(new BasicSessionCredentials(accessKey, secretKey, sessionToken));
mClient.setRegion(Region.getRegion(Regions.US_WEST_2));
mUtility = new TransferUtility(mClient, mContext);
TransferObserver observer = mUtility.upload(mBucketName, remotePath, new File(localPath), CannedAccessControlList.PublicReadWrite);
但是总是会出现“访问被拒绝”错误。