Here's how to get started with the spotify-web-api-node library:
const Spotify = require("spotify-web-api-node")
!(async () => {
// Create an API instance.
const api = new Spotify({
clientId: "<client_id>",
clientSecret: "<client_secret>",
redirectUri: "https://example.com",
})
// Even though you've provided a client ID and secret above, you'll still need
// to get an access token for this session's requests.
const accessTokenResponse = await api.clientCredentialsGrant()
const accessToken = accessTokenResponse.body["access_token"]
spot.setAccessToken(accessToken)
// Then use the API!
const response = await api.getUserPlaylists("jrc03c")
const playlists = response.body.items
console.log(playlists)
})()
NOTE: The above is not intended for client-side use!