Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

313
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda