How to hide my 3rd party API key for ReactJS App with AWS Amplify?

Viewed 216

I'm using AWS Amplify to handle my ReactJS app. While it is convenient that AWS Amplify handles all backend functionality, I don't see any way I can write any of my own backend code to hide from the users. In particular, I'd like to hide my 3rd party API Key, and all the logic associated with the API results. Is there a way I can do this with Amplify or should I just try a different Amazon Compute service?

1 Answers

I am new to AWS but if you are asking how to hide the API key you can use the .env file. Create a ".env" file on the root directory and then name it " REACT_APP_apiKey= your API key here". After this point, you can use it anywhere in your react application as in " const myAPI = process.env.REACT_APP_apiKey; "

Related