Skip to content

Instantly share code, notes, and snippets.

@mkriegeskorte
mkriegeskorte / last-played-spotify-song.js
Created September 28, 2020 16:35
Get recently played Spotify Track in serverless function running on vercel
const axios = require('axios')
const spotifyAPIBaseUri = 'https://api.spotify.com'
const spotifyAccountsBaseUri = 'https://accounts.spotify.com'
const {
SPOTIFY_CLIENT_ID, // Your Spotify OAuth Client ID
SPOTIFY_CLIENT_SECRET, // Spotify OAuth Client Secret
SPOTIFY_REFRESH_TOKEN, // Your personal refresh token (you have to authenticate yourself against your app once to receive this)
} = process.env