-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauth.js
23 lines (17 loc) · 1.27 KB
/
auth.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var redirect_uri = "https://abhijeet-2003.github.io/SoundStream/player.html"; // change this your value
var client_id = "";
var client_secret = ""; // In a real app you should not expose your client_secret to the user
const AUTHORIZE = "https://accounts.spotify.com/authorize"
function requestAuthorization(){
client_id = document.getElementById("clientId").value;
client_secret = document.getElementById("clientSecret").value;
localStorage.setItem("client_id", client_id);
localStorage.setItem("client_secret", client_secret); // In a real app you should not expose your client_secret to the user
let url = AUTHORIZE;
url += "?client_id=" + client_id;
url += "&response_type=code";
url += "&redirect_uri=" + encodeURI(redirect_uri);
url += "&show_dialog=true";
url += "&scope=ugc-image-upload user-read-playback-state user-modify-playback-state user-read-currently-playing app-remote-control streaming playlist-read-private playlist-read-collaborative playlist-modify-private playlist-modify-public user-follow-modify user-follow-read user-read-playback-position user-top-read user-read-recently-played user-library-modify user-library-read user-read-email user-read-private";
window.location.href = url; // Show Spotify's authorization screen
}