-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcallback.html
More file actions
33 lines (31 loc) · 1.09 KB
/
Copy pathcallback.html
File metadata and controls
33 lines (31 loc) · 1.09 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Record Player</title>
<link rel="icon" type="image/png" href="/images/favicon.png">
</head>
<body>
<script>
function getHashParams() {
const hashParams = {};
let e, r = /([^&;=]+)=?([^&;]*)/g,
q = window.location.hash.substring(1);
while (e = r.exec(q)) {
hashParams[e[1]] = decodeURIComponent(e[2]);
}
return hashParams;
}
const params = getHashParams();
const accessToken = params.access_token;
if (accessToken) {
// Store the token or use it directly to initialise the player
localStorage.setItem('spotifyAccessToken', accessToken);
window.location = 'https://recordplayer.vercel.app/player.html'; // Redirect back to the main page
} else {
console.error('No access token found in URL');
}
</script>
</body>
</html>