Announcements

Help Wizard

Step 1

NEXT STEP

Client-side only for album pre-save?

Client-side only for album pre-save?

I am mainly a musician but have some web dev experience that has gotten rusty over the past few years. I am trying to roll my own Album "pre-save" that doesn't request user info but saves my upcoming album to their library.

 

Is it possible to authorize Spotify to save an album only on the client side?

 

For example, I have this URL

https://accounts.spotify.com/authorize?client_id=[MY CLIENT ID]&albums&ids=[ALBUM URI]&redirect_uri=[MY REDIRECT URI]&scope=user-library-modify&response_type=token

 

This works as far as authorization and redirect but the album isn't saved. I also cannot find any documentation on a client side only request so I assume this request needs to be PHP? Even though I don't want access to any user info? 

 

Any suggestions?

Reply
1 Reply

I've made some progress and realized I needed an Ajax function on the callback.

So now I have it set up and it seems to be sending the request info but I am getting a 403 'Insufficient client scope' error when trying to save an album even though the request and auth have 'user-library-modify' set.

 

$.ajax({
url: 'https://api.spotify.com/v1/me/albums?ids=7qkBrY5sRxEt41dvzH6lMH',
headers: {
'Authorization': 'Bearer ' + accessToken
},
success: function(response) {
console.log(response);
},
error: function(response){
console.log(response);
}
})

Suggested posts