When navigating through external OAuth providers, window.opener is lost, causing postMessage to fail. The callback now stores the result in localStorage as a fallback mechanism.
···23All notable changes to this project will be documented in this file.
4000000000005## [2.5.0] - 2025-01-09
67### Added
···23// PWA detects standalone mode and opens OAuth in popup
24const popup = window.open("/login?handle=user.bsky&pwa=true", "oauth-popup");
2526-// Listen for postMessage from popup
27-window.addEventListener("message", (event) => {
28- if (event.data.type === "oauth-callback" && event.data.success) {
0000029 // Session cookie is set, reload to pick it up
30 location.reload();
31 }
32-});
33```
3435### Security
3637- PWA callbacks still set the session cookie for API authentication
38- The `postMessage` only sends `did` and `handle` (no tokens)
39-- Fallback redirect to home page if `window.opener` is unavailable
4041## [2.4.0] - 2025-12-14
42
···23All notable changes to this project will be documented in this file.
45+## [2.5.1] - 2025-01-09
6+7+### Fixed
8+9+- **PWA OAuth localStorage fallback**: Added localStorage-based communication as
10+ a fallback for PWA OAuth flows. When navigating through external OAuth
11+ providers (like bsky.social), the `window.opener` reference is lost, causing
12+ `postMessage` to fail. The callback now stores the result in localStorage,
13+ which the opener can read via the `storage` event or by checking localStorage
14+ when the popup closes.
15+16## [2.5.0] - 2025-01-09
1718### Added
···34// PWA detects standalone mode and opens OAuth in popup
35const popup = window.open("/login?handle=user.bsky&pwa=true", "oauth-popup");
3637+// Listen for both postMessage and localStorage
38+window.addEventListener("message", handleOAuthResult);
39+window.addEventListener("storage", (e) => {
40+ if (e.key === "pwa-oauth-result") handleOAuthResult(JSON.parse(e.newValue));
41+});
42+43+function handleOAuthResult(data) {
44+ if (data.type === "oauth-callback" && data.success) {
45 // Session cookie is set, reload to pick it up
46 location.reload();
47 }
48+}
49```
5051### Security
5253- PWA callbacks still set the session cookie for API authentication
54- The `postMessage` only sends `did` and `handle` (no tokens)
55+- localStorage data is cleared after successful read
5657## [2.4.0] - 2025-12-14
58