mirror of
https://github.com/Noratrieb/spotify-sorter-node.git
synced 2026-01-14 16:45:11 +01:00
webserver for login
This commit is contained in:
parent
dbac630155
commit
d39420b3dc
8 changed files with 332 additions and 1 deletions
32
index.html
Normal file
32
index.html
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Spotify Sorter</title>
|
||||
</head>
|
||||
<body>
|
||||
You can close this window now.
|
||||
<script>
|
||||
const hash = window.location.hash
|
||||
.substring(1)
|
||||
.split("&")
|
||||
.reduce((initial, item) => {
|
||||
if (item) {
|
||||
const parts = item.split("=");
|
||||
initial[parts[0]] = decodeURIComponent(parts[1]);
|
||||
}
|
||||
return initial;
|
||||
}, {});
|
||||
window.location.hash = "";
|
||||
|
||||
if (hash.access_token) {
|
||||
fetch("http://localhost:8080", {
|
||||
method: "POST",
|
||||
body: hash.access_token
|
||||
})
|
||||
} else {
|
||||
console.error("No access_token present in hash")
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue