Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

"This functionality is restricted to premium users only" error even though I have Premium account.

"This functionality is restricted to premium users only" error even though I have Premium account.

I'm receiving "This functionality is restricted to premium users only" error even though I Premium account. This code was working 1 year ago. I have created my Spotify account just now and cancelled the free trial and got a paid Premium Individual to see if that's the case. Still getting the same error. What might be the problem?

 

Here is my code:

 

 

 

 

 

 

 

setupSpotifyPlayer(cb) {
                var self = this
                // window.onSpotifyWebPlaybackSDKReady = () => {
                self.player = new Spotify.Player({
                    name: 'MusicSpace Spotify Player',
                    getOAuthToken: callback => {
                        callback(self.user.spotifyWebApiToken);
                    },
                    volume: 1
                });

                self.player.addListener('ready', ({device_id}) => {
                    if(!this.playerConfigured) {
                      bus.$on("player:play", (track) => {
                          this.playTrack(track)
                      })
                    }
                    this.playerConfigured = true

                    console.log('Ready with Device ID', device_id);
                    this.deviceId = device_id

                    self.play = ({
                                     spotify_uri,
                                     playerInstance: {
                                         _options: {
                                             getOAuthToken,
                                             id
                                         }
                                     }
                                 }) => {
                        getOAuthToken(access_token => {
                            fetch(`https://api.spotify.com/v1/me/player/play?device_id=${device_id}`, {
                                method: 'PUT',
                                body: JSON.stringify({uris: [spotify_uri]}),
                                headers: {
                                    'Content-Type': 'application/json',
                                    'Authorization': `Bearer ${access_token}`
                                },
                            });
                        });
                    };

                    if(cb)
                      cb();
                });

                // Not Ready
                self.player.addListener('not_ready', ({device_id}) => {
                    console.log('Device ID has gone offline', device_id);
                });

                self.player.addListener('initialization_error', ({message}) => {
                    console.error(message);
                });

                self.player.addListener('authentication_error', ({message}) => {
                    console.error(message);
                });

                self.player.addListener('account_error', ({message}) => {
                    console.error(message);
                });

                self.player.addListener('player_state_changed', ( state => {

                    if (!state) {
                        return;
                    }

                    this.spotifyPaused = state.paused
                }));




                self.player.connect()


                // }
            },

 

 

 

 

 

 

  

Reply
1 Reply

The code of how you get an Access Token missing. It is only going to work when your code lets you log in.

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

Suggested posts

Let's introduce ourselves!

Hey there you,   Yeah, you! 😁   Welcome - we're glad you joined the Spotify Community!   While you here, let's have a fun game and get…

ModeratorStaff / Moderator/ 4 years ago  in Social & Random