Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

315
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!