1

I have a React app that needs to communicate with several AWS services, each requiring secret keys and I know that I should not hard-code them into the JS.

I found this: How do I hide API key in create-react-app?

Which basically confirms the following: * Do not store true secrets in your JS * Do not use env files either, because they are added to the JS at compile time. * Use server-side code to deal with secret server-to-server communications, i.e. use a proxy

But my question is now one of clarity on this or "next step". My proxy server now handles all of the private communications with AWS. However, how do I confirm my app's identity to the server? In other words, if open the proxy up, anyone will have access to my AWS content. However, my actual users are not authorized to access my external services directly, so I can't just pass through those credentials.

My idea is to set up an application ID that will redirect only to the associated URL, but is that secure enough? The appID is in the JS, but the ID will only allow the proxy to send information back to the URL on record.

Thank you, Wayne

Wayne F. Kaskie
  • 3,257
  • 5
  • 33
  • 43

1 Answers1

0

I think your best bet would be to use AWS Cognito.

Users will auth with it, get back a token which can have IAM access rights attached to it if that is what you desire

Jonathan Irwin
  • 5,009
  • 2
  • 29
  • 48