0
votes

New to iOS and programming in general. I'm working with Spotify SDK (beta) to try and make a client to stream tracks that I've saved.

When calling their savedTracksForUserInSession method, which I was told to do by their developers, I keep getting a 403 error: Forbidden. My session is good, so is another method that is used to play their tracks/album/artists...

Any help would be much appreciated!

-(void)fetchSavedTrack:(SPTSession*) session {

[SPTRequest savedTracksForUserInSession:session callback:^(NSError *error, SPTListPage* trackList) {
    if (error != nil) {
        NSLog(@"%@", error);
        return;
    }

    NSLog(@"This block is being run");

    self.savedTracks = [[NSArray alloc]initWithArray:trackList.items];
    NSLog(@"%@", self.savedTracks);
}];
}

SOLUTION: Had to add SPTAuthUserLibraryReadScope scope for authorization. Thanks, Armin for pointing it out to me.

1
You're trying to save a track to the user's library, so my suspicion is that your application hasn't been given the user-library-modify scope.Michael Thelin
actually, this is to fetch the already saved tracks not save to libraryTuan Anh Vu
Ah, I misread it as "saveTracksForUserInSession". Carry on :-)Michael Thelin

1 Answers

0
votes

You probably have to add the proper "Scope" to be able to get access to read the user's saved tracks. You probably need the user-library-read scope.