amazon-archives / aws-sdk-react-native

AWS SDK for React Native (developer preview)
Apache License 2.0
631 stars 68 forks source link

[Feature Request] Support for Basic Authentication #11

Open MadisonBlake opened 7 years ago

MadisonBlake commented 7 years ago

In my application of this package I need to publicly read from some database. For now I have chosen to use a DynamoDB and want to use this package to do the reading.

I do not provide a user-log in any way in my app, so authentication with only cognito isn't really applicable. I suppose I could set a up a single cognito user and have that user log-in "under the surface", but that is awkward.

My thought was to use a IAM user, configured to only have read access to database. To do this, the AmazonDynamoDBClient object would need to be constructed with BasicAWSCredentials (or AWSStaticCredentialsProvider) instance instead of CognitoCachingCredentialsProvider.

I think this is a pretty reasonable scenario that other users will surely encounter. Although I freely admit: I am somewhat new to AWS (and app development as a whole), so any recommendations are welcome.

To support my needs, I forked this repo and added changes to do Basic Authentication. That fork can be viewed here: https://github.com/MadisonBlake/aws-sdk-react-native. Note that I have not implemented ios support (yet), nor have I tested that my changes didn't break Cognito authentication.