From 225a05028be332389e324852299cfca93f4f720c Mon Sep 17 00:00:00 2001 From: Elogain <52982000+Elogain@users.noreply.github.com> Date: Fri, 20 Sep 2019 14:29:54 +0100 Subject: [PATCH] Search requires token these days Should work once the user has logged in now.. and I think you need the token to get the preview. --- api.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/api.js b/api.js index 0b882ed..38ee906 100644 --- a/api.js +++ b/api.js @@ -7,6 +7,9 @@ var url = 'https://api.spotify.com/v1/search?type=track&q='+encodeURIComponent(query); $.ajax(url, { dataType: 'json', + headers: { + 'Authorization': this.login.getAuthHeader() + }, success: function(r) { console.log('got tracks', r); callback(r.tracks.items); @@ -21,6 +24,9 @@ var url = 'https://api.spotify.com/v1/tracks/'+encodeURIComponent(id); $.ajax(url, { dataType: 'json', + headers: { + 'Authorization': this.login.getAuthHeader() + }, success: function(r) { console.log('got track', r); callback(r);