Social Annotations in the Atmosphere
1<!DOCTYPE html>
2<html>
3<head>
4 <meta charset="UTF-8">
5 <title>OAuth Callback</title>
6</head>
7<body>
8 <p>Redirecting...</p>
9 <script>
10 // Relay to Chromium extension callback
11 const extensionId = 'kjdnjfgcikmlbloojphbkmknfpmfofio';
12 const extRedirect = `https://${extensionId}.chromiumapp.org/extension-callback.html`;
13
14 // Check if we are already in the extension context to avoid infinite loops
15 const isExtension = window.location.protocol === 'chrome-extension:' ||
16 window.location.hostname.endsWith('.chromiumapp.org') ||
17 window.location.protocol === 'moz-extension:';
18
19 if (!isExtension) {
20 // We are on the web server (relay), so redirect to the extension
21 console.log('Relaying to extension:', extRedirect);
22 window.location.href = extRedirect + window.location.search + window.location.hash;
23 } else {
24 // We are in the extension
25 console.log('Authentication successful!');
26 // The browser should handle closing this window via launchWebAuthFlow,
27 // but we can show a message just in case.
28 document.querySelector('p').textContent = 'Authenticated. This window will close automatically.';
29 }
30 </script>
31</body>
32</html>