I know that hardcoded creds are a big no no.
But I want to write an app just for me. No one else would get this app.
So I wanted to put my accessKey and secretKey directly into the code so that the app will be able to download files from my s3 bucket.
Edit:
So now I’m at this state:
runBlocking {
val s3 = S3Client.fromEnvironment {
credentialsProvider = StaticCredentialsProvider(Credentials("some-access-key", "some-secret-key"))
region = "some-region"
}
try {
val getObjectRequest = GetObjectRequest {
bucket = "some-bucket"
key = "some-key"
}
val response: GetObjectResponse = s3.getObject(
getObjectRequest
)
println("File downloaded successfully")
} catch (e: Exception) {
println("Error downloading file: ${e.message}")
} finally {
s3.close()
}
}
and on the getObjectRequest Android Studio states No value passed for parameter 'block'
.
I’m not sure how to proceed.
1