I am developing a React application which uses Supabase and OpenAI API. To hide the secret prompt from the user, I created /api directory and added an endpoint for receiving the prompt. This solves the problem, however the other problem is that EVERYONE can access it.
CORS policy blocks requests from other domains but this is only relevant to browsers. Requests from Postman or any other http client can freely access it.
To my knowledge, there isn't any direct way to implement this. What is the simplest way to achieve what I want (I'm quite new to this)?
I really am confused. I see recommendations to create an API key for my own backend API, but then we are back to the same situation that I begin with that I need to hide an API key from frontend.