Creating a Simple Spotify Authorization Popup in Javascript

Using Implicit Grant Flow

Image for post
Image for post
popup =
'Login with Spotify',
window.spotifyCallback = (payload) => {
fetch('', {
headers: {
'Authorization': `Bearer ${payload}`
}).then(response => {
return response.json()
}).then(data => {
// do something with data
token = window.location.hash.substr(1).split('&')[0].split("=")[1]if (token) {

Written by

I develop websites for rock 'n' roll bands and get paid in sex and drugs. Previously Silva Artist Management, SoundCloud, and Songkick. Currently: Available

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store