Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace the API key with a cookie-based JWT #147

Open
programarivm opened this issue Jan 24, 2024 · 0 comments
Open

Replace the API key with a cookie-based JWT #147

programarivm opened this issue Jan 24, 2024 · 0 comments

Comments

@programarivm
Copy link
Member

programarivm commented Jan 24, 2024

A rather basic authentication mechanism has recently been implemented consisting of an X-Api-Key HTTP header which is sent by the web browser to the API server in each request. CORS has been successfully set up in the NGINX web server as well as in the Symfony application.

All API endpoints are now supposed to block queries from any user agent other than a web browser; for example, cURL or Postman. However, in reality, the network traffic can be monitored using the developer tools of any modern browser.

figure_01
Figure 1. The API key is sent by the web browser in an X-API-key HTTP request header.

The API key can be easily obtained by a malicious user for further use in cURL queries. It is more convenient to store a JWT in a cookie as a temporary user credential in order to limit how the API is used.

Happy coding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant