Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

151
Vistas
How to verify that an API Request is coming from my Javascript on my Site?

I have some JS on my website which requests Data from my own PHP API and the API request data from external APIs (Google, YT etc.)

How can my own PHP API can verify, that the request is from MY Javascript and not from someone else?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If all you want to do is to simply prevent people from accessing your API through JS on other sites you can just set the CORS header Access-Control-Allow-Origin to your own domain.

header("Access-Control-Allow-Origin: your.domain.here");

Note that this doesn't mean people can't access your API through direct calls using software like Postman, python scripts etc.

If, for example, you want only yourself and/or specific users to be able to access the API you could look into php session management. This way you can create accounts which are allowed to access specific data on your API.

You could also use API keys to allow users to directly communicate with your API if needed.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda