Answer the question
In order to leave comments, you need to log in
How to close rest api?
Good afternoon!
Tell me how to hide the public api, from public access, so that only my website (application on express.js) would have access to it. Is it possible to somehow sign it, or use third-party services?
Answer the question
In order to leave comments, you need to log in
you make it so that api should accept all requests only if there is a certain token in the header. if the token is missing or incorrect, you send back a response with status 401.
The client and server can receive this token, for example, through environment variables (so as not to shine them in the code)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question