Block api for public #1331
Unanswered
adamgasiorek
asked this question in
Q&A
Replies: 1 comment 1 reply
|
If you want to merely prevent other websites from firing requests against your API you can look into setting CORS headers. Note that these do not apply to other ways your API can be accessed like via scripts. The only way to block an API from public access on the web in general is through some form of authentication. That requires some sort of authenticated login/account before the API will serve any result. The client usually receives some sort of token to which a secret counterpart exists on the server. But even that gives you no guarantee that all requests were made through your app. A logged in user could just grab the token and use it to fire requests via curl. That's not a limitation of unique to fresh, but rather how the web works. |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hey, what is the best way to block api (routes/api) from public access? And make it only avaiable from app?
All reactions