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

174
Views
Cookies don't get attached even after using storage API
const iframe = document.createElement("iframe");
iframe.sandbox.add('allow-scripts', 'allow-storage-access-by-user-activation', 'allow-same-origin');
iframe.onload = function () {
    window.addEventListener('load', () => {
        document.getElementById('test-button').addEventListener('click', () => {
            getStorageAccess().then(_ => {
                var xhr = new XMLHttpRequest();
                xhr.open('POST', 'https://example.net/v1/set-key-authorization-cookie/cb325a10-9404-4f77-b615-319415fa945a', true);
                xhr.setRequestHeader('Content-Type', 'application/json');
                xhr.withCredentials = true;
                xhr.send('{"KeyAuthorizationToken": "eyJhbGciOiJFUzI1NiIsImtpZCI6Ij"}');
                xhr.onreadystatechange = function () {
                    if (this.readyState == this.HEADERS_RECEIVED && this.status == 200) {
                        var xhr2 = new XMLHttpRequest();
                        xhr2.open('GET', 'https://example.net/v1/get-key/cb325a10-9404-4f77-b615-319415fa945a?encrypted-key-container=eyJhbGciOiJFUzI1Ni', true);
                        xhr2.withCredentials = true;
                        xhr2.send(null);
                    }
                }
            });
            console.log("The iframe is loaded" + getStorageAccess());
        });
    });
};
document.body.appendChild(iframe);

My inner request xhr2 needs some cookies from xhr request. getStorageAccess promise is resolved but no cookies in request.

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!