从S3下载文件时,AWS令牌已过期

时间:2016-09-27 21:37:13

标签: android amazon-web-services amazon-s3 aws-sdk

我正在尝试使用AWS SDK for Android从我的S3存储桶下载文件。这是我正在使用的代码:

addFirst

此代码抛出以下错误:

CognitoCachingCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider(
            getApplicationContext(),
            "my identitiy pool id", // Identity Pool ID
            Regions.AP_NORTHEAST_1 // Region
    );

    AmazonS3 s3 = new AmazonS3Client(credentialsProvider);
    TransferUtility transferUtility = new TransferUtility(s3, getApplicationContext());

    TransferObserver observer = transferUtility.download(
            "mybucket",     /* The bucket to download from */
            "logo.png",    /* The key for the object to download */
            imageFile        /* The file to download the object to */
    );

我刚刚在AWS Cognito上创建了凭据,它无法过期。有什么我做错了吗?

1 个答案:

答案 0 :(得分:0)

这可能是一个临时问题。我在一段时间后重试了它并且有效。