From dfeef56c90e1d106222bedef6db6383ddf155e95 Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Sat, 25 Jul 2026 15:50:39 -0700 Subject: [PATCH] Sign in first in the requestPermission fixture's email flow on the web In env=web the site has no auth token, so whoami threw 401 immediately and the email button appeared to do nothing. Sign in via popup first, matching the real third-party flow; env=app already has a token and is unaffected. --- src/puter-js/tests/e2e/fixtures/request-permission.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/puter-js/tests/e2e/fixtures/request-permission.html b/src/puter-js/tests/e2e/fixtures/request-permission.html index c7416ec53..0ef66523e 100644 --- a/src/puter-js/tests/e2e/fixtures/request-permission.html +++ b/src/puter-js/tests/e2e/fixtures/request-permission.html @@ -49,9 +49,15 @@ } waitForPuter(); - // Requests to see the user's email; needs whoami (env=app only). + // Requests to see the user's email. Needs whoami, which needs an + // auth token: in env=app the GUI injects one, but in env=web the + // site must sign in first (the realistic third-party flow). document.getElementById('req-email-perm').addEventListener('click', async () => { try { + if (!puter.authToken) { + log('perm:email:signing-in'); + await puter.auth.signIn(); + } const whoami = await puter.auth.whoami(); const granted = await puter.ui.requestPermission({ permission: `user:${whoami.uuid}:email:read`,