Airbnb

फ्रीमियम
द्वारा 3B Data / @CRAWLER2API | अपडेट किया गया 21 giorni fa | Travel
लोकप्रियता

9.6 / 10

लेटेंसी

2,637ms

सेवा का स्तर

100%

Health Check

N/A

सभी चर्चाओं पर वापस जाएं

Hiding this api key in .env

Rapid account: Esser Mishelle
EsserMishelle
2 mesi fa

Hey I am trying to hide my api key by using dotenv but it doesn’t work unless I hardcode my api key in my OPTIONS–

App.js—

const API_BASE_URL= process.env.REACT_APP_API_BASE_URL || “https://airbnb13.p.rapidapi.com”;
const API_KEY = process.env.REACT_APP_API_KEY;

const options = {
method: “GET”,
headers: {
“X-RapidAPI-Key”: “API_KEY”, //// I don’t want to hardcode my api key here but this line doesn’t work
"X-RapidAPI-Host": “airbnb13.p.rapidapi.com”,
},
};

const getStay = async () => {

In dotenv–
REACT_APP_API_BASE_URL=https://airbnb13.p.rapidapi.com
REACT_APP_API_KEY=fake12345

Is there a trick to make it work like the codes I have above, instead of hardcoding “X-RapidAPI-Key”: “fake12345”,

चर्चा में शामिल हों - नीचे टिप्पणी जोड़ें:

नई टिप्पणियाँ पोस्ट करने के लिए लॉग इन / साइनअप करें