-
Notifications
You must be signed in to change notification settings - Fork 549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AmazonS3Client(new CognitoCachingCredentialsProvider(context, config)) is deprecated #960
Comments
@mbk820 Your concern is valid. I would recommend you to use Amazon Cognito Identity Pools which retrieves a set of temporary credentials (AWS Access and Secret Access Keys) that are valid for an hour and the SDK retrieves new credentials after the expiration. AWSConfiguration awsConfiguration = new AWSConfiguration(getApplicationContext());
CognitoCachingCredentialsProvider awsCreds = new CognitoCachingCredentialsProvider(getApplicationContext(), awsConfiguration);
AmazonS3Client s3Client = new AmazonS3Client(awsCreds, Region.getRegion(Regions.US_EAST_2));
TransferUtility transferUtility = TransferUtility.builder()
.context(getApplicationContext())
.awsConfiguration(awsConfiguration)
.s3Client(s3Client)
.build(); Take a look at our documentation for more details: https://aws-amplify.github.io/docs/android/storage |
@kvasukib Hi dear, Hope you are fine, We are using s3 paid services, Our app is live with a lot of users, our users are facing ANRs while initializing 'CognitoCachingCredentialsProvider' and creating 'TransferUtility' object, and some other ANRs, all are related AWS. We have to load a lot of images from s3 storage at runtime while the user scrolling the recycle view. This is ANR stats, Please give some time, and provide a solution. `
|
Thanks for the update. @kvasukib Can you make a note of this crash? |
Hey, should I use 'CredentialsProvider' with my secret key in my live application?
Anyone can decompile the APK and get my secret and access keys,
What is the right way to initialize the s3 client and use the s3 bucket storage?
Even in AWS documentation, the deprecated method is mentioned. Please guide.
Right now I am using:
AWSConfiguration config = new AWSConfiguration(context); transferUtility = TransferUtility.builder() .context(context) .awsConfiguration(config) .s3Client(new AmazonS3Client(new CognitoCachingCredentialsProvider(context, config))) .build();
By using this crash occurs on mostly KitKat devices:
Caused by java.lang.IllegalArgumentException TransferUtility has not been configured with a default bucket. Please use the corresponding method that specifies the bucket name or configure the default bucket name in construction of the object. See TransferUtility.builder().defaultBucket() or TransferUtility.builder().awsConfiguration()
But if I use this:
BasicAWSCredentials awsCreds = new BasicAWSCredentials("access_key_id", "secret_key_id"); AmazonS3Client s3Client = new AmazonS3Client(awsCreds, Region.getRegion(Regions.US_EAST_2));
Anyone can decompile the APK and get my secret and access keys.
What is the exact right way to use Transfer Utility and initializing the s3 client?
@kvasukib sir please see this.
The text was updated successfully, but these errors were encountered: