Jammming Project => Tracks aren't added to Playlist

I just finished The Jammming Project and when I save the tracks into my playlist, on Spotify the playlist is created but there aren’t any tracks in it.

In developer tools, the error I’m getting is this:

image

{
  "error": {
    "status": 401,
    "message": "No token provided"
  }
}

This is the code for the savePlaylist() section which was part of step 89 to 95:

    savePlaylist(playlistName, trackURIs) {
        if (!playlistName || !trackURIs.length) {
            return;
        }
        const accessToken = Spotify.getAccessToken();
        const headers = {Authorization: `Bearer ${accessToken}`};
        let userID;

        return fetch('https://api.spotify.com/v1/me', {headers: headers})
        .then(response => {
            return response.json();
        }).then(jsonResponse => {
            userID = jsonResponse.id;
            return fetch(`https://api.spotify.com/v1/users/${userID}/playlists`, {
                headers: headers,
                method: 'POST',
                body: JSON.stringify({name: playlistName})
            }).then(response => {
                return response.json();
            }).then(jsonResponse => {
                const playlistID = jsonResponse.id;
                return fetch(`https://api.spotify.com/v1/users/${userID}/playlists/${playlistID}/tracks`, {
                    headers: headers,
                    method: 'POST',
                    body: JSON.stringify({uri: trackURIs})
                })
            })
        });
    }

Another issue is that when I search for a track/artist/name/etc. the page loads again and I have to type the track/artist/name/etc. again for it to work and after that It doesn’t happen again with a new search but if I reload the page, it happens again.

Is anyone else experiencing the same issues or is it just me?

Solved the first problem by changing uri: trackURIs to uris: trackURIs in this part:

The second problem is also apparent in Codecademy’s own Jammming project.

Hope this helps someone experiencing the same problem.