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

168
Vistas
Javascript authenticate website using included script

I want to have one application, that serves javascript code performing stuff such as cookies management or run validation and so on and other website, that includes this code. The thing is, the script should perform GET and POST on the server and should somehow authenticate itself. For example when user accepts cookie form, this consent should be sent to the server so it could be stored as a proof to our authorities, but every website will have different users and I want to identify them for each website. Also, there should't be a way of forging the requests leading to false data. This should go as follows:

  1. server.com provides javascript and database of consents.

  2. User goes to example.com that has this javascript included.

  3. User clicks accept.

  4. Website sends this information to server.com

  5. Server.com checks, if the request was really sent by example.com and writes to db.

  6. Everyone is happy.

It could work somehow like google analytics identifies the website? (Don't know how) I've spent too much time googling and going through source codes and couldn't find anything.

EDIT: I was thinking of taking advantage of CORS. Site will send request to server and it will respond with some token and set Access-Control-Allow-Origin and the site will now on use this token, that will be valid only for a certain period of time, maybe usage count limited. Would this be reasonable solution? Could this be somehow forged?

about 4 years ago · Juan Pablo Isaza
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