···
4
-
<meta charset="utf-8">
5
-
<meta name="viewport" content="width=device-width, initial-scale=1">
6
-
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'unsafe-inline'; style-src 'unsafe-inline'">
7
-
<title>Authorization Successful - Coves</title>
10
-
font-family: system-ui, -apple-system, sans-serif;
12
-
align-items: center;
13
-
justify-content: center;
16
-
background: #f5f5f5;
23
-
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
26
-
.success { color: #22c55e; font-size: 3rem; margin-bottom: 1rem; }
27
-
h1 { margin: 0 0 0.5rem; color: #1f2937; font-size: 1.5rem; }
28
-
p { color: #6b7280; margin: 0.5rem 0; }
30
-
display: inline-block;
32
-
padding: 0.75rem 1.5rem;
33
-
background: #3b82f6;
35
-
text-decoration: none;
39
-
a:hover { background: #2563eb; }
43
-
<div class="container">
44
-
<div class="success">✓</div>
45
-
<h1>Authorization Successful!</h1>
46
-
<p id="status">Returning to Coves...</p>
47
-
<a href="#" id="manualLink">Open Coves</a>
51
-
// Parse and sanitize query params - only allow expected OAuth parameters
52
-
const urlParams = new URLSearchParams(window.location.search);
53
-
const safeParams = new URLSearchParams();
55
-
// Whitelist only expected OAuth callback parameters
56
-
const code = urlParams.get('code');
57
-
const state = urlParams.get('state');
58
-
const error = urlParams.get('error');
59
-
const errorDescription = urlParams.get('error_description');
60
-
const iss = urlParams.get('iss');
62
-
if (code) safeParams.set('code', code);
63
-
if (state) safeParams.set('state', state);
64
-
if (error) safeParams.set('error', error);
65
-
if (errorDescription) safeParams.set('error_description', errorDescription);
66
-
if (iss) safeParams.set('iss', iss);
68
-
const sanitizedQuery = safeParams.toString() ? '?' + safeParams.toString() : '';
70
-
const userAgent = navigator.userAgent || '';
71
-
const isAndroid = /Android/i.test(userAgent);
73
-
// Build deep link based on platform
76
-
// Android: Intent URL format
77
-
const pathAndQuery = '/oauth/callback' + sanitizedQuery;
78
-
deepLink = 'intent:/' + pathAndQuery + '#Intent;scheme=social.coves;package=social.coves;end';
80
-
// iOS: Custom scheme
81
-
deepLink = 'social.coves:/oauth/callback' + sanitizedQuery;
84
-
// Update manual link
85
-
document.getElementById('manualLink').href = deepLink;
87
-
// Attempt automatic redirect
88
-
window.location.href = deepLink;
90
-
// Update status after 2 seconds if redirect didn't work
91
-
setTimeout(function() {
92
-
document.getElementById('status').textContent = 'Click the button above to continue';