Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

tntman's avatar

Securing API ( JWT )

Hello, i am using JWT token based auth and everything related to it.

I am not sure how can I secure my app. When i say secure i mean how can i prevent users to make requests to my API from their for example desktop programs.

Since i am using axios to perform GET and POST requests anyone can see api endpoints cuz they are on front end and they can figure out whole URI needed to send request. After that they can basically imitate request using Postman or any other tool out there, they can also make their own applications and perform requests to my API and I dont want that, so what's the solution ? How can i prevent this ?

0 likes
4 replies
topvillas's avatar

JWT is good for authenticating users but no good for securing an API.

Get API users to generate an API key and make them to send it in a header with requests. Then do any checks you need in some middleware.

tntman's avatar

"Get API users to generate an API key and make them to send it in a header with requests."

Can you elaborate this little bit ?

tntman's avatar

I saw your links and they are not providing answers to my questions

Please or to participate in this conversation.