I’m currently considering starting a project that involves the Spotify API and I stumbled across this article that was supposed to help me get started with working with it. There’s also a repo that goes with it and that’s where I’m getting stuck.
When I start the app on my local machine, the screen looks like this:
I’m (struggling with) authenticating to Spotify using Implicit Grant Flow, where I provide a clientId, response_type, redirect_uri (in my case, I have it set to http://localhost:3000), state and scope.
But yet, I get the error. I checked the Network tab on Dev Tools and saw I am getting a 405: Not Allowed Http Error but I can’t understand, if I followed all the directions per the article and README.md, why?
Did you clone the repo or did you follow the article? Because the article code and repo code is not the same. In the article the config code is written in App.js, in the repo code it is in the config file and is imported into App.js.
Also, remember to set the redirectUri in the spotify app settings (it also won’t work on CodeSandbox).
I just tested it and it works for me. Just be aware that you need to be logged in and have something playing otherwise the app crashes in the getCurrentlyPlaying function (data will be undefined).
Thank you! The problem was in App.js in the render section; the anchor tag with href={'${authEndpoint}... was written wrong on my part. Fixed it. It now works!