Next.js Discord

Discord Forum

How do I know if my sensitivity code/credentials gets passed to the client or not?

Answered
Havana posted this in #help-forum
Open in Discord
HavanaOP
It's not transparent if my functions are safe or not.

For example, say in my NextJS project, I have an api.ts file with a function that declares constants for credentials. Do these credentials get passed to the client, just by defining them?
Answered by @ts-ignore
yes but it is recommended to use env vars for sensitive credentials as you've to explicitly specify which env var is exposed to client with NEXT_PUBLIC_
View full answer

5 Replies

HavanaOP
So only when I import the file from a file that has "use client"?
@Havana So only when I import the file from a file that has "use client"?
yes but it is recommended to use env vars for sensitive credentials as you've to explicitly specify which env var is exposed to client with NEXT_PUBLIC_
Answer
HavanaOP
@@ts-ignore thanks. do you perhaps also know the answer on my new question?: https://nextjs-forum.com/post/1226566085562859531