DEV Community

Discussion on: Sending Contact Form Messages to Your Email Inbox

Collapse
 
seriouslee13 profile image
SeriousLee13

No, wait. Don't proces.env variables get inserted at runtime? Like, can't you just get the api keys by opening devtools, going to Application > Frames > Scripts, and searching for "require('node-mailjet').connect" ?

Collapse
 
xinnks profile image
James Sinkala

Yes they do, I was being more general and didn't want it to be a segue into a detailed explanation on process.env and serverless functions. Have realized the need for precision on what I was talking about and have done just that. Thanks for pointing that out 👍.

Collapse
 
seriouslee13 profile image
SeriousLee13

Thanks for the response. But then how do you do frontend api call without exposing your api secret key? Seems to me, the only way to do this would be via a server-side function of some sort?

Thread Thread
 
xinnks profile image
James Sinkala

The secret keys are only accessed by the server-side function, the front end just makes API calls and has no access to the keys.