Nuxt proxy or middleware for hiding client_secret and client_id #8661
Replies: 1 comment 1 reply
-
Your question is kinda all over the place, and I couldn't fully understand what the real question is... but.... What we do here on the company I work for is like so: For env_vars that we want only the server to have, we add this value as a proper system enviroment variable, defining export MY_SECRET_API_KEY="abcd-efg-hij-klmn"
# now run the command
npm run dev # which runs `nuxt` And then on the code we access it by The |
Beta Was this translation helpful? Give feedback.
-
Hi Everyone! I've read many workarounds, but still have no clue how to hide client_id and client_secret on server side, and how to proxify POST request and put two fields (client_id and client_secret respectively) to it. I know that I need to use serverMiddleware or @nuxt/proxy or something else. But how I can change POST request's body and resubmit request with credentials? How can I debug server side middleware or anything else server-side using console.logs? I've read this https://nuxtjs.org/blog/moving-from-nuxtjs-dotenv-to-runtime-config/ but that's not helpful because of exposing credentials in axios requests. Thanks a lot
Beta Was this translation helpful? Give feedback.
All reactions