Search code examples
iosnetwork-programmingsdkspotifyhttp-status-code-403

Spotify SDK iOS SDK 403 error


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.


Solution

  • 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.