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

312
Vistas
How to share cookies in IOS WebView or PWA

I'm currently working on a project that saves a login session in cookies, but currently I have a problem sharing the cookies beetween browser and a WebView.

I start the user interaction with the user reading a QrCode with the camera, but if the user wants to login I send a text message with the login session, but I can't find the cookies that I stored previously.

As far as I know thats because when I store cookies in the first session it stores in a WebView in the camera app and when I open a link inside the message app it opens another WebView and the cookies are not shared.

Is there a way to preserve the cookies beetween web sessions?

Edit:

Here is some code that I used to store the cookies and cache.

Cookie:

function setCookie(name, value, days) {
  var expires = "";
  if (days) {
    var date = new Date();
    date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
    expires = "; expires=" + date.toUTCString();
  }
  document.cookie = name + "=" + (value || "") + expires + "; path=/";
}

Cache:

async function saveCache(token) {
  try {
    let authCache = await caches.open('auth');
    const responseBody = JSON.stringify({
      token
    });
  
    const response = new Response(responseBody);
    await authCache.put('/auth', response);
  } catch (error) {
    console.log("saveCache error:", { error });
  }
}
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