-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspotify-callback.html
More file actions
86 lines (83 loc) · 2.72 KB
/
spotify-callback.html
File metadata and controls
86 lines (83 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!DOCTYPE html>
<html>
<head>
<title>Spotify Auth - Redirecting...</title>
<style>
body {
background: #0f0f0f;
color: white;
font-family: system-ui;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
}
.container {
text-align: center;
}
.spinner {
border: 4px solid #333;
border-top: 4px solid #1DB954;
border-radius: 50%;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
margin: 0 auto 20px;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
code {
background: #1a1a1a;
padding: 10px 20px;
border-radius: 5px;
display: inline-block;
margin: 20px 0;
font-size: 14px;
color: #1DB954;
}
</style>
</head>
<body>
<div class="container">
<div class="spinner"></div>
<h2>Spotify Authentication Successful!</h2>
<p>Redirecting to Recallify...</p>
<p style="font-size: 14px; color: #888; margin-top: 20px;">
If the app doesn't open automatically,<br>
copy this code and paste it in Recallify:
</p>
<code id="auth-code"></code>
<p style="font-size: 12px; color: #666; margin-top: 20px;">
You can close this window once redirected.
</p>
</div>
<script>
// Extract the authorization code from URL
const urlParams = new URLSearchParams(window.location.search);
const code = urlParams.get('code');
const error = urlParams.get('error');
if (error) {
document.querySelector('.container').innerHTML = `
<h2 style="color: #f44;">Authentication Failed</h2>
<p>Error: ${error}</p>
<p style="font-size: 14px;">Please close this window and try again.</p>
`;
} else if (code) {
document.getElementById('auth-code').textContent = code;
// Try to redirect to the Tauri app
// The app should be running on localhost:1420
setTimeout(() => {
window.location.href = `http://localhost:1420/spotify-callback?code=${code}`;
}, 1500);
} else {
document.querySelector('.container').innerHTML = `
<h2 style="color: #f44;">No Authorization Code</h2>
<p>Please close this window and try again.</p>
`;
}
</script>
</body>
</html>