You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

15 lines
529 B

// The authorization token to use with the Spotify API.
// Will need to be refreshed once in a while.
let authToken: string | null = null;
export async function getAuthToken(clientId: string, clientSecret: string) {
let requestOpts = {
method: "POST",
headers: { "Authorization": "Basic " + clientId + ":" + clientSecret },
}
const response = await fetch("https://accounts.spotify.com/api/token?grant_type=client_credentials", requestOpts)
return await response.json();
}
export async function