Jammming: Problem with getAccessToken method

Hi, at first I thought this was only a problem with my implementation, but there seems to be a problem with the instructions provided, since the behaviour also occurs on the example webpage at http://jammming.s3-website-us-east-1.amazonaws.com/. When I authorize my account with Spotify and THEN reload the page, the first search does not work as expected (the results flicker up but then disappear). I take it that something is wrong with Spotify module’s getAccessToken method, but I am unable to work out how to fix it. The problem seems to be that because of the page reload the accessToken variable becomes unset, but Spotify does not require a new authentication from the browser and consequently does not show its login window. If there is any suggestion on how to fix this (the project workthrough’s solution is not working correctly either), this would be much appreciated!


If that was happening on the example website they’ve fixed it now but I’m still getting the error.

edit: I take that back, it IS happening on their page as well.

this is happening to me too. i tried using event.preventDefault to stop the page from reloading, but it always reloads after the first search.

I think it’s because the token isn’t in the url so the page redirects:

window.location = redirect;

However, now that it is in the url, it gets cleared out when you search:

window.history.pushState("Access Token", null, "/");

They said it was to prevent expired token being pulled from the url but it’s a not a great solution.

1 Like