Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion get_user_profile/src/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// we detect a callback from Spotify by checking for the hash fragment

const clientId = "your-client-id-here"; // Replace with your client id
const redirect_uri = "REDIRECT_URI"; // Replace with your redirect uri
const params = new URLSearchParams(window.location.hash.substring(1));
const code = params.get("access_token");

Expand All @@ -16,7 +17,7 @@ async function redirectToAuthCodeFlow(clientId: string) {
const params = new URLSearchParams();
params.append("client_id", clientId);
params.append("response_type", "token");
params.append("redirect_uri", "http://localhost:5173/callback");
params.append("redirect_uri", redirect_uri);
params.append("scope", "user-read-private user-read-email");

document.location = `https://accounts.spotify.com/authorize?${params.toString()}`;
Expand Down