- From: Daniel Capeletti <notifications@github.com>
- Date: Tue, 04 Sep 2018 02:35:37 -0700
- To: w3c/manifest <manifest@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Tuesday, 4 September 2018 09:36:59 UTC
My fix is similar to @socceroos. I had to redirect the user to a different domain so we would have a different context there. My solution to communicate between Safari tab and the PWA is basically using Cache API:
var content = { token: "{{ user.token }}"}; // a token provided by backend
var blob = new Blob([JSON.stringify(content, null, 2)], {type : 'application/json'});
var resp = new Response(blob,{ "status" : 200 , "statusText" : "ok" });
caches.open('/').then(function(cache) {
cache.put('/token/', resp); // put this token on cache
});
When coming back to PWA I got this by reading the cache:
const req = new Request('/token/');
caches.match(req).then(response => response.json()).then(({ token }) => console.log(token));
It's not a pleasant experience, we're encouraging the user to install the PWA after he authorises in Safari. That should reduce the usage of this flow.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/manifest/issues/550#issuecomment-418304316
Received on Tuesday, 4 September 2018 09:36:59 UTC