I am currently working on a vanilla JavaScript project. Within the app.js file, I am making an API call to retrieve specific values. Initially, I tested the API using Postman by including all the necessary headers there and then implemented the code in my JavaScript fetch function. Everything is functioning correctly, but the issue is that my token and session id are appearing in the code.
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Token <mytoken>");
myHeaders.append("Cookie", "sessionid= <mysessionid>");
myHeaders.append("User-Agent", "Mozilla/5.0");
I am wondering how I can securely store these sensitive values in a .env file for better security.
Thank you!