1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
import { querystring } from "https://esm.town/v/stevekrouse/querystring";
export let spotifyRefreshToken = async ({ refresh_token, client_id, client_secret }) =>
fetchJSON("https://accounts.spotify.com/api/token", {
method: "POST",
body: await querystring({
refresh_token: refresh_token,
grant_type: "refresh_token",
}),
headers: {
"Authorization": "Basic " + (new Buffer(client_id + ":" + client_secret).toString("base64")),
"Content-Type": "application/x-www-form-urlencoded",
},
});
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
January 12, 2024