DEV Community

Discussion on: Protecting your API keys with Next JS

Collapse
 
j0hannr profile image
j0hannr • Edited

Thanks! I used headers to pass the SECRET_KEY.

const response = await axios.get(`/api/secret/index/`, { headers: {"secret_key" : process.env.SECRET_KEY}});
Enter fullscreen mode Exit fullscreen mode